In: Computer Science
# print out the steps to make chex mix, taking into account whether or not to include peanuts
# Here is the pseudo code we developed earlier:
#
#Get Bowl
#Add wheat Chex
#Add cheez-its
#Add Pretzels
#Add m & ms (why? – just taking it from the video…)
#If no peanut allergy
# Add peanuts
#else (there was a peanut allergy)
# if we have another bowl
# get second bowl
# put some of the mix so far into the second bowl
# add peanuts to second bowl
# else (at this point there was a peanut allergy, but no second
bowl)
# don’t do anything. We’re done.
# Here is the start of the Python code
print("Get Bowl")
print("Add wheat chex to bowl")
print("Add cheez-its to bowl")
print("Add pretzels to bowl")
print("Add m & ms to bowl")
# Note that the string in the following prompt has embedded
single quotes inside double quotes
peanut_allergy = input("Is there a peanut allergy? (enter 'yes' or
'no')")
# finish the code
# when it's time to ask for the second bowl, use this as the
prompt:
# "Is there a second bowl? (enter 'yes' or 'no')"
print("Get Bowl")
print("Add wheat chex to bowl")
print("Add cheez-its to bowl")
print("Add pretzels to bowl")
print("Add m & ms to bowl")
peanut_allergy=input("Is there a peanut allergy? (enter 'yes' or
'no')")
if peanut_allergy=='no':
print("Add peanuts to bowl")
else:
#there was peanut allergy ask for second
bowl
check_second_bowl=input("Is there a second bowl?
(enter 'yes' or 'no')")
if check_second_bowl=='yes':
print("Get Second
Bowl")
print("Put some of the
mix so far into second bowl")
print("Add peanuts to
second bowl")
Output