[Tutor] Extremely simple question
Max S.
maxskywalker1 at gmail.com
Wed Jan 11 14:11:32 CET 2012
I believe that line 3 raises an error. The because you contained the text
in single quotes, and then used the same character in 'you're not chris',
Python believes that you are trying to type "you" re not chris". You can
change the single quotes surrounding your string to double quotes ("you're
not chris"), triple-single quotes ('''you're not chris'''), or
triple-double quotes ("""you're not chris"""), or you can tell Python that
you want to include the apostrophe in your string by preceding it with a \
('you\'re not chris'). The latter works on the same idea as \n and \t.
On Wed, Jan 11, 2012 at 6:04 AM, col speed <ajarncolin at gmail.com> wrote:
> >>>>
> >>>>> your_weight = int(raw_input("Please enter your weight: "))
> >>>>> if your_weight < 0:
> >>>>> print 'You're not Chris!'
> >>>>> elif your_weight == 170:
> >>>>> print 'You might be Chris! But...'
> >>>>> your_height = int(raw_input("Please enter your height: "))
> >>>>> if your_height < 180:
> >>>>> print 'You're not Chris!
> >>>>> elif your_height == 180:
> >>>>> print 'You're Chris!'
> >>>>> your_name = int(raw_input("What is your name? "))
> >>>>> elif your_height > 180:
> >>>>> print 'You're not Chris!"
> >>>>> elif x > 170:
> >>>>> print 'You're not Chris!'
> >>>>
> >>>>
> >>>> When I open it, the program says I have a syntax error. Praytell,
> where
> >>>> did
> >>>> I go wrong?n
> I'm a newbie, but I get "NameError" because 'x' is not defined.
> Also "your_name = int(raw_input("What is your name? "))" will give this :
> ValueError: invalid literal for int() with base 10: 'name'.
> As you can't change a string to be an int.
> I can't find a syntax error, but next time, please paste the whole
> traceback as this helps people with less time than me to sort out
> problems.
>
> Good luck with Python
> Col
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120111/13756d57/attachment-0001.html>
More information about the Tutor
mailing list