Explore Further

These are good links to check out after watching the videos on this page

Related Links

Strings and Variables

Raw Input

Exercise: Asking Questions

The exercises on this page were taken from Learn Python The Hard Way. They have been edited for our IDLE 2.6.6 development environment.

Most of what software does is the following:

  1. Take some kind of input from a person.
  2. Change it.
  3. Print out something to show how it changed.

So far you have only been printing, but you haven't been able to get any input from a person, or change it. You may not even know what "input" means, so rather than talk about it, let's have you do some and see if you get it. Next exercise we'll do more to explain it.

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 " + age + " old, " + height + " tall and " + weight + " heavy."

What You Should See

>>> ================================ RESTART ================================
How old are you? 55
How tall are you? 5'8"
How much do you weigh? 180lbs
So, you're 55 old, 5'8" tall and 180lbs heavy.

Extra Credit

  1. Go online and look up Python's raw_input.
  2. Can you find other ways to use it? Try some of the samples you find.
  3. Write another "form" like this to ask some other questions.