When you typed raw_input() you were typing the ( and ) characters which are parenthesis. This is similar to when you used them to do a format with extra variables, as in "%s %s" % (x, y). For raw_input you can also put in a prompt to show to a person so they know what to type. Put a string that you want for the prompt inside the () so that it looks like this: y = raw_input ("Name? ")
This prompts the user with "Name?" and puts the result into the variable y. This is how you ask someone a question and get their answer. This means we can completely rewrite our previous exercise using just raw_input to do all the prompting.
#!/usr/bin/env python# -*- coding: utf-8 -*-age = raw_input("How old are you? ")height = raw_input("How tall are you? ")weight = raw_input("How much do you weigh? ")print "So, you're %r old, %r tall and %r heavy." % (age , height, weight)
result:
Extra Credit
1. In Terminal where you normally run python to run your scripts, type: pydoc raw_input. Read what it says.
2. Get out of pydoc by typing q to quit.
3. Go look online for what the pydoc command does.
4. Use pydoc to also read about open, file, os, and sys . It's alright if you do not understand those, just read through and take notes about interesting things.