Permalink
Browse files

added extra credit

  • Loading branch information...
mwarkentin committed Jan 13, 2011
1 parent 4e627a6 commit 1120302ff677b4a6de69d295aedc4465d21e4bbf
Showing with 34 additions and 7 deletions.
  1. +34 −7 ex30.py
View
41 ex30.py
@@ -1,23 +1,50 @@
people = 30
cars = 40
buses = 15
# sets the variable "people" to 50
people = 50
# sets the variable "cars" to 60
cars = 60
# sets the variables "buses" to 50
buses = 50
# if "cars is greater than people"
if cars > people:
# print string
print "We should take the cars."
# else if "cars is less than people"
elif cars < people:
# print string
print "We should not take the cars."
# else
else:
# print string
print "We can't decide."
# if "buses greater than cars"
if buses > cars:
print "that's too many buses."
# print string
print "That's too many buses."
# else if "buses less than cars"
elif buses < cars:
# print string
print "Maybe we could take the buses."
# else
else:
print "We still can't decide."
# if "people is greater than buses"
if people > buses:
# print string
print "Alright, let's just take the buses."
# else
else:
print "Fine, let's stay home then."
# print string
print "Fine, let's stay home then."
# Extra credit
# 1.a. elif means "else if" - if the previous "if" statement is False, python checks if this elif statement is True. If it is, the code block under it will be evaluated.
# 1.b. else means "else" - if the previious "if (or elif)" statement is False, python evaluates the code block under the "else" statement

0 comments on commit 1120302

Please sign in to comment.