need help with python

Ian Clark turbana at gmail.com
Fri May 11 22:11:52 EDT 2007


On 11 May 2007 18:47:27 -0700, adamurbas at hotmail.com
<adamurbas at hotmail.com> wrote:
> ya so im pretty much a newb to this whole python thing... its pretty
> cool but i just started today and im already having trouble.  i
> started to use a tutorial that i found somewhere and i followed the
> instructions and couldnt get the correct results.  heres the code
> stuff...
>
> temperature=input("what is the temperature of the spam?")
> if temperature>50:
>         print "the salad is properly cooked."
> else:
>         print "cook the salad some more."
>
> ya i was trying to do that but when i told it what the spams
> temperature was, it just turned off... well it wasnt working at all at
> first until i realized that i hadnt been following the instructions
> completely correctly and that i was supposed to type that code up in a
> notepad then save and open with python... so ya thats when it asked me
> what temperature the spam was and i typed a number then it just closed
> itself... im not really sure what went wrong... itd be real nice if
> someone would be like a mentor or something...
>

I'm making a couple of assumptions here (correct me if I'm wrong):

1. You're using windows
2. You double clicked on the .py file

What this does is open up a new terminal window and start execution of
the program. The program will execute to completion and then the
window will close automatically without waiting for you to tell it to
(lovely isn't it?). To get around this you have a couple options:

1. Run the script from the command line
2. Put this at the end of the .py file: input('Press ENTER to continue')

Ian



More information about the Python-list mailing list