[Tutor] Why do I get an "unvalid syntax" on the print line for number1
Don Jennings
dfjennings at gmail.com
Tue Apr 23 20:55:01 CEST 2013
On Apr 23, 2013, at 2:19 PM, Chris “Kwpolska” Warrick wrote:
> On Sat, Apr 20, 2013 at 10:33 PM, Pat Collins <collins.pat0108 at gmail.com> wrote:
>> Any help appreciated.
>>
>>
>> #!/usr/bin/env python
>> """
>> number.py Demonstrates collecting a number from the user.
>> """
>>
>> number_string1 = float(input("Give me a number: "))
>> number1 = (number_string1)
>>
>> number_string2 = float(input("Give me another number: "))
>> number2 = (number_string2)
>>
>> print number1, "times", number, "+", number1 * number2
>>
>>
>> _______________________________________________
>> Tutor maillist - Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>>
>
> You are probably using Python 3 (check with `python --version`). In
> this version, print is a function. You need to do the following
> instead:
>
> print(number1, "times", number, "+", number1 * number2)
Once the OP fixes that error, I suspect another one will appear:
NameError: name 'number' is not defined
Take care,
Don
More information about the Tutor
mailing list