Difference between revisions of "Python Boolean Exercises"
From WLCS
(Created page with "==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 expres...") |
|||
Line 16: | Line 16: | ||
==Exercises== | ==Exercises== | ||
+ | * Slurpee Exercise | ||
+ | *# Prompt the user to see if they are near a 7-11 (yes/no) | ||
+ | *# Prompt the user to see how much money they have | ||
+ | *# 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 | ||
+ | * |
Revision as of 13:37, 27 September 2012
Contents
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
- Open Wing IDE 101
- Complete the following Python exercises
References
Exercises
- Slurpee Exercise
- Prompt the user to see if they are near a 7-11 (yes/no)
- Prompt the user to see how much money they have
- 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