This command tells the computer to wait for user input before continuing. So if you write,
print 'hello world'
raw_input('press enter to continue')
print 'goodbye'
It would print, "hello world" and wait until you press enter to continue, then print "goodbye"
You can also put input into variables. For example, if you want to make a variable "name" and have it ask for a name, you write:
name = raw_input('what's your name?')
Press enter to insert what you typed into the variable.
To make it print the name you typed in, write:
print name
This prints what you have entered as your name.
Next post : else, if and then commands
Friday, March 20, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment