Chapter 2 Exercises

  < Previous  Next >
Write python statements to do the following:
  1. Store 42 into a variable named theAnswer
  2. Store 3.14159 into a variable named pi
  3. Print out the following:
    Hello, world!
  4. Store the following into a variable named joke:
    There are 10 types of people in the world.  Those that understand binary and those that don't!
    See also this FoxTrot comic
  5. Display on the screen only the first 41 characters of joke.
  6. Display pi with 3 digits of precision
  7. Request that the user enter a number, and store that number into a variable name years