Question

Starting out with Python 4th edition Chapter 2 Programming Exercise 10 Ingredient Adjuster Not sure how...

Starting out with Python 4th edition

Chapter 2 Programming Exercise 10 Ingredient Adjuster

Not sure how to do this

Homework Answers

Answer #1

CODE

def main():

cookies = float(input("How many cookies would you like to make?\n>"))

# Calulate sugar ((1.5 * cookies) / 48)

# Store answer (sugar)

sugar = (1.5 * cookies) / 48.0

# Calculate butter (cookies / 48)

# Store answer (butter)

butter = cookies / 48

# Calculate flour ((2.75 * cookies) / 48)

# Store answer (flour)

flour = (2.75 * cookies) / 48

print("To make ", cookies, " cookies, you will need:\n", \

format(sugar, '.2f'), " cups of sugar\n", \

format(butter, '.2f'), " cups of butter\n", \

format(flour, '.2f'), " cups of flour", sep='')

iterate()

def iterate():

yn = input("Want to continue(y/n) ? ")

if yn == 'y' or yn == 'Y':

main()

exit(0)

if __name__ == "__main__":

main()

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
NOTE:- PLEASE USE THE INSTRUCTION ACCORDING TO "CHAPTER 3" OF "STARTING OUT WITH PYTHON 4TH EDITION"...
NOTE:- PLEASE USE THE INSTRUCTION ACCORDING TO "CHAPTER 3" OF "STARTING OUT WITH PYTHON 4TH EDITION" PROGRAM 3_1:- Write a program that determines the cost of online order of T-shirts. T-shirts are priced at $12.99 each, but discounts are applied for quantities as follows: - 12 or more shirts earn a 30% discount and free shipping - 6-11 shirts earn a 20% discount - and 3-5 shirts earn a 10% discount - 1 or 2 shirts, no discounts Prompt the...
Python Programming 4th Edition: - Write a program that test and display if a number enter...
Python Programming 4th Edition: - Write a program that test and display if a number enter is divisible by 2 and/or 3. Hints: - Use the correct operation - Prompt the user to enter a number The output should look like as follows - Enter an integer: --Number is divisible by 2 and 3 --Number is divisible by either 2 or 3, but not both --Number is not divisible by either 2 or 3
Book name is Starting Out with Programming Logic and Design (5th Edition) Chapter 6: Functions Algorithm...
Book name is Starting Out with Programming Logic and Design (5th Edition) Chapter 6: Functions Algorithm Workbench 1. Design a simple function named timesDozen that accepts an Integer argument into a parameter named nbr. When the function is called, it should return the value of its argument multiplied times 12. 2. Assume that a program has two String variables named alpha and bravo. Write - a pseudocode statement that assigns an all uppercase version of alpha to the bravo variable.
find the question for chapter 2 exercise 3 page 83. Programming logic and design by joyce...
find the question for chapter 2 exercise 3 page 83. Programming logic and design by joyce farrell edition 9.
what am i doing wrong here ? starting out with c++ early objects 9th edition chapter...
what am i doing wrong here ? starting out with c++ early objects 9th edition chapter 10 programming challenge 6 #include <iostream> using namespace std; int main() {       double findMedian(int* numbers, int size) {    double median;    if (size % 2 == 0)        median = (double)(*(numbers + ((size - 1) / 2))            + *(numbers + (((size - 1))) / 2;    else                median = *(numbers + ((size -...
For chapter 1 problem 6 of the Applied Linear Regression Models 4th Edition book, I found...
For chapter 1 problem 6 of the Applied Linear Regression Models 4th Edition book, I found the formula using B_0 (200) and B_1 (5), my equation is y=200+5x. How do you calculate the error terms e_i or graph the error terms with the correlating data points when the only other information given is just the standard deviation equals 4?
Business statistics solutions manuals / Criminal Law for the Criminal Justice Professional / 4th edition/chapter 7...
Business statistics solutions manuals / Criminal Law for the Criminal Justice Professional / 4th edition/chapter 7 / problem 1pse Judy was single and depressed because she had just broken up with her boyfriend. She went to a neighborhood bar with some friends so they could cheer her up. At the bar, she met Peter, a tall, good-looking, friendly guy. He said he was interested in “partying” with her. They went back to her place after she described it as being...
Textbook: introduction to community & public health edition 8 or 9 Chapter 10: Based on your...
Textbook: introduction to community & public health edition 8 or 9 Chapter 10: Based on your reading and response, in what populations will there be increased need for culturally competent community/public health workers over the next two decades - during your career as a community/public health worker? As a community health professional, where do you see yourself being more effective...in what areas do you think you would be more effective? How will you prepare for this?
from book corporate Finance (3Rd edition) chapter 2-Problem 11P I have questions: How can you explain...
from book corporate Finance (3Rd edition) chapter 2-Problem 11P I have questions: How can you explain the paid -n -capital in excess of par formula?
Compute the least squares regression line for the data in Exercise 2 of Chapter 10, Section...
Compute the least squares regression line for the data in Exercise 2 of Chapter 10, Section 2 “The Linear Correlation Coefficient”. data: x 0 2 3 6 9 y 0 3 3 4 8