Python Input and Output
Output is easy. Just use the print command
print "Hello World"
Put whatever you want to put on the screen after the word print. You can output many things by separating them with a comma
print "Hello ",username," how are you?"
Normally the print command will add a new line when it is finished. If you don't want it to do that, then just add a comma right at the end.
print "Hello ",
Input is more tricky, because there's an extra step needed if you want to input a number.
You also need to make sure that whatever is input is stored in a variable
Let's start with entering text - for example, the user's name
username = raw_input()
This line creates a variable called username and puts into it (assigns) whatever the user types in. The result will be text, even if the user types a number.
Don't forget the two brackets at the end of raw_input(). It won't work if you leave these out.
Here's an example of using both input and output.
print "Hello, what is your name ",
To input numbers we need to first use the raw_input() command above to get the text form of a number, then we need to convert it to an integer
print "Enter a number:",