[Tutor] problem with code

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Aug 21 15:00:39 CEST 2015


On 20/08/2015 15:49, Aravind Jaya wrote:
> time = input("How long on average do you spend on the computer per day?")
> if time <= 2:
>      print "Message1"
> else:
>      print "Message2"

If you insist on top posting you could at least get your response 
correct.  The comparison will fail in Python 3.3 as time will be a 
string, you've missed the conversion to int, and print should be a 
function, not a statement.

> On Thu, Aug 20, 2015 at 3:20 PM, Nathan Clark <261100nc at gmail.com> wrote:
>
>> I have written a basic program out of python and it is not functioning,
>> please could you proof read my code and tell me how to fix it.It is in
>> python 3.3
>>
>> time=int(input("How long on average do you spend on the computer per day?")
>> (print("that seems reasonable")) if time<=2
>> else print ("get a life")

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Tutor mailing list