[Tutor] command error help

Alan Gauld alan.gauld at btinternet.com
Sun Feb 14 17:02:19 CET 2010


"Shurui Liu (Aaron Liu)" <shurui91 at gmail.com> wrote

> SyntaxError: EOL while scanning single-quoted string.

Yes, that sounds about right.
But it doesn't add much. Can you print the entifre error
message not just that single line? Or....

>> Here is a program I need to run in putty.exe, but there is an error in 
>> it.
>> I cannot find out. When I ran this program, it mentions that the error 
>> is in
>> red line.

How are you running the code in putty.
I don't get any red lines in my terminal...
It suggests you might be using some other tool or IDE perhaps?

Since I can't see any single quoted strings in your code we
can't begin to guess what line the error pertains to.
It might for example be one of the apostraphes thats causing the error?

>> name = raw_input("Hi.  What's your name? ")
>> age = raw_input("And how old are you? ")
>> age = int(age)
>>
>> weight = raw_input("Okay, last question.  How many pounds do you weigh? 
>> ")
>> weight = int(weight)
>>
>> print "\nIf poet ee cummings were to email you, he'd address you as", 
>> name.lower()
>> ee_mad = name.upper()
>> print "But if ee were mad, he'd call you", ee_mad
>>
>> dog_years = age / 7
>> print "\nDid you know that you're just", dog_years, "in dog years?"
>> seconds = age * 365 * 24 * 60 * 60
>> print "But you're also over", seconds, "seconds old."
>>
>> called = name * 5
>> print "\nIf a small child were trying to get your attention, " \
>>
>>       "your name would become:"
>> print called
>>
>> moon_weight = weight / 6.0
>> print "\nDid you know that on the moon you would weigh only", 
>> moon_weight, "pounds?"
>>
>> sun_weight = weight * 27.1
>> print "But on the sun, you'd weigh", sun_weight, "(but, ah... not for 
>> long)."
>>
>> raw_input("\n\nPress the enter key to exit.")


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 




More information about the Tutor mailing list