Question

In: Computer Science

# print out the steps to make chex mix, taking into account whether or not to...

# 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')"

Solutions

Expert Solution

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

  


Related Solutions

Question 4 a) James believes that taking into account the characteristics, attitudes, steps in critical thinking...
Question 4 a) James believes that taking into account the characteristics, attitudes, steps in critical thinking as well as the communication behaviors, people are more likely to be made critical thinkers than being born as such. Illustrate your agreement or disagreement with the above statement. . Justify your answer using relevant and concrete examples. (CR – 6 marks) b) Choosing the appropriate learning space makes a whole difference in how well a student prepares for examination. Sometimes, the failure of...
You are taking out a $25,000 loan for a new car. You will make monthly payments...
You are taking out a $25,000 loan for a new car. You will make monthly payments for 5 years. You are given the choice between putting nothing down and a 7% APR OR putting $5000 down and a 5% APR. Which do you choose?
Hello, How can I make the program print out "Invalid data!!" if the file has a...
Hello, How can I make the program print out "Invalid data!!" if the file has a grade that is not an A, B, C, D, E, or F or a percentage below zero. The program should sort a file containing data about students like this for five columns: one for last name, one for first name, one for student ID, one for student grade percentage, one for student grade. Smith Kelly 438975 98.6 A Johnson Gus 210498 72.4 C Reges...
//using c fixing the error to make a correct print-out. #include <stdio.h> int main(void) { unsigned...
//using c fixing the error to make a correct print-out. #include <stdio.h> int main(void) { unsigned int a = 1000; signed int b = -1; if (a > b) printf("%d is more than ", a); printf("%d\n", b); else printf("%d is less or equal than ", a); printf("%d\n", b); return 0; }
Look at this scenario. You are attempting to make a decision whether to eat out tonight...
Look at this scenario. You are attempting to make a decision whether to eat out tonight or cook. What is the process you go through to make your decision? Use the decision making process as you explain your results. Do not assume it is best to cook. It may not be depending on your meal and how many people you have to feed. Explain in 125 words with a credible resource.
A firm must decide whether to make a component part in-house or to contract it out...
A firm must decide whether to make a component part in-house or to contract it out to an independent supplier. Manufacturing the part requires a nonrecoverable investment in specialized assets. The most efficient suppliers are located in countries with currencies that many foreign exchange analysts expect to appreciate substantially over the next decade. What are the pros and cons of (a) manufacturing the component in-house and (b) outsourcing manufacturing to an independent supplier? Which option would you recommend and why?...
Out of 100 seniors, 60 are taking math, 50 are taking biology, 30 are taking art,...
Out of 100 seniors, 60 are taking math, 50 are taking biology, 30 are taking art, 16 are taking math and biology, 10 are taking biology and art and 6 are taking all three subjects out of 100 seniors 60 are taking math 50 or taking biology 30 are taking art 30 or taking math and art 16 are taking math and art 10 taking biology and art and six are taking all three subjects
A farmer plans to mix two types of food to make a mix of low cost...
A farmer plans to mix two types of food to make a mix of low cost feed for the animals in his farm. A bag of food A costs $10 and contains 40 units of proteins, 20 units of minerals and 10 units of vitamins. A bag of food B costs $12 and contains 30 units of proteins, 20 units of minerals and 30 units of vitamins. How many bags of food A and B should the consumed by the...
What steps are needed to make UMP into dTMP? Write out each step, using standard abbreviations...
What steps are needed to make UMP into dTMP? Write out each step, using standard abbreviations for the nucleotides, and including co-substrates that make sense or are specifically needed (for each step).
what are the necessary steps researchers are taking to avoid the bias and ensure that they...
what are the necessary steps researchers are taking to avoid the bias and ensure that they have a significant and accurate estimate of the true association between the exposure and the outcome?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT