Python Boolean Exercises

From WLCS
Revision as of 13:37, 27 September 2012 by Admin (talk | contribs)

Objectives

  • You will learn to use if-statements to control program flow
  • You will learn to write Boolean logic expressions
  • You will learn to combine multiple logic expressions using:
    • and
    • or
    • not

Directions

  1. Open Wing IDE 101
  2. Complete the following Python exercises

References

Exercises

  • Slurpee Exercise
    1. Prompt the user to see if they are near a 7-11 (yes/no)
    2. Prompt the user to see how much money they have
    3. Using a single if-else statement, print out whether or not they can purchase a slurpee
      • To buy a slurpee, the user needs to be near a 7-11 AND have at least $3