1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
algol [13]
3 years ago
14

A cookie recipe calls for the following ingredients: • 1.5 cups of sugar • 1 cup of butter • 2.75 cups of flour The recipe produ

ces 48 cookies with this amount of ingredients. Write a program that asks the user how many cookies they want to make and then displays the number of cups of each ingredient needed for the specified number of cookies in the following format: You need 5 cups of sugar, 3 cups of butter, and 7 cups of flour.

Computers and Technology
1 answer:
True [87]3 years ago
4 0

The program that asks the user how many cookies they want to make and then displays the number of cups of each ingredient is corresponds to the ingredients mentioned above.

<h3>Further explanation</h3>

Python is a general-purpose programming language. We want to write a python program that asks the user how many cookies they want to make and then displays the number of cups of each ingredient.

48 cookies = 1.5 cups of sugar + 1 cup of butter + 2.75 cups of flour, so:

def main():

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

   sugar = (1.5 * cookies) / 48.0

   butter = cookies / 48

   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='')

   redoQuery()  

def redoQuery():

   yn = input("Would you like to check another batch size? (y/n)\n>")

   if yn == 'y':

       main()

   elif yn =='n':

       exit()

   else:

       print("Please enter only a lowercase \'y\' or lowercase \'n\'," \

             "then press enter")

       redoQuery()

main()

The run program is shown in the attachment below.

<h3>Learn more</h3>

1. Learn more about python https://brainly.in/question/8049240

 

<h3>Answer details</h3>

Grade:  9

Subject: Computers and Technology

Chapter:  programming with python

Keywords: python

You might be interested in
Object-Oriented Programming (Using Java Language)
Delicious77 [7]

Answer:

import java.util.Scanner;

class Main {  

 public static void main(String args[]) {

       Scanner scan = new Scanner(System.in);

       System.out.print("Enter a decimal value (0 to 15): ");

       int num = scan.nextInt();

       scan.close();

       

       if (num < 0 || num >15) {

           System.out.printf("%d is an invalid input\n", num);

       } else {

           System.out.printf("The hex value is %X\n", num);

       }

 }

}

Explanation:

Hopefully this example will get you going for the other assignments.

3 0
2 years ago
What is the meaning of Ram?​
masya89 [10]

Answer:

Random-Access Memory

Explanation:

used as a short-term memory for computers to place its data for easy access

5 0
1 year ago
Which university first developed the use of email?
Arte-miy333 [17]

Answer:

Massachusetts Institute of Technology (MIT)

Explanation:

4 0
2 years ago
Pete would like to respond only to users within his organization with an automatic reply. He is configuring the automatic respon
Ahat [919]

Answer:

megan pete

Explanation:lol just  had to

4 0
2 years ago
Write a program that prints the question " Do youwant to continue? " and reads a user input. if the userinput is " Y ", " OK", o
Nataly_w [17]

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

   string in;//string in for taking input...

   cout<<"Do you want to continue ?"<<endl;

   getline(cin,in);//taking input from the user...

   if(in=="y"||in=="Y"||in=="yes"||in=="OK"||in=="Why not?")//conditions..

   cout<<"OK"<<endl;

   else if(in=="No")

   cout<<"terminating"<<endl;

   else

   cout<<"Bad input"<<endl;

return 0;

}

Explanation:

I have taken a string in.

Then taking input from user.

Checking the conditions using if else if ladder.

7 0
2 years ago
Other questions:
  • An Open Authorization (OAuth) access token would have a _____ that tells what the third party app has access to
    5·1 answer
  • Motorcycles have two or three wheels, a seat for the rider and at least a ____ horse-powered engine.
    15·1 answer
  • 60 POINTS!
    13·1 answer
  • ______ is the software that prevents people from being able to access your personal information.
    8·2 answers
  • Joe always misspelled the word calendar what function corrects the word
    12·2 answers
  • Write a SELECT statement that selects all of the columns for the catalog view that returns information about foreign keys. How m
    6·1 answer
  • Explain how technology is related to human needs and wants?
    13·1 answer
  • When you connect a device to your computer for the first time, Windows Media Player selects the ____ method that works best for
    15·2 answers
  • What is the meaning of antimonographycationalis​
    9·2 answers
  • What is the suffix of hollow?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!