#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    5
    Rep Power
    0

    Unexpected character after line continuation character


    I keep getting an error message after print (time, \t, distance). Any suggestions? Thanks.
    #Distance traveled challenge

    def main():
    # Get user input for speed in mph
    speed = int (input('Enter speed traveled in mph:'))

    # Get user input for hours traveled
    time = int(input('Enter time traveled for trip in hours:'))

    # Print the Header
    print()
    print('Hours \tDistance Traveled')
    print('_________________________')

    #for loop for display
    for time in range (1, time + 1):
    distance = time * speed
    print (time, \t, distance)

    #call main
    main()
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,850
    Rep Power
    481

    tab character is a string


    Try it like this:
    print (time, '\t', distance)
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    5
    Rep Power
    0

    it worked


    thanks

IMN logo majestic logo threadwatch logo seochat tools logo