Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise Set 1: 1. Write a Python statement that subtracts the variable down_payment from the variable total and assigns the result to the variable due.

image text in transcribed
image text in transcribed
Exercise Set 1: 1. Write a Python statement that subtracts the variable down_payment from the variable total and assigns the result to the variable due. 2. Write a Python statement that multiplies the variable subtotal by 0.15 and assigns the result to the variable total. 3. Miles-per-Gallon A car's miles-per-gallon (MPG) can be calculated with the following formula: MPG= Miles driven / Gallons of gas used. Write a program that asks the user for the number of miles driven and the gallons of gas used. It should calculate the car's MPG and display the result. Exercise Set 2: 1. Tip, Tax, and Total Write a program that calculates the total amount of a meal purchased at a restaurant. The program should ask the user to enter the charge for the food, then calculate the amounts of a 18 percent tip and 7 percent sales tax. Display each of these amounts and the total. 2. Circle Measurements Write a program that asks the user to enter the radius of a circle. The program should calculate and display the area and circumference of the circle using r2 for the area and 2r for the circumference. Hint: You can either use 3.14159 as the value of pi ( ), or add the statement "import math" to the start of the program and then use "math.pi" wherever you need the value of pi in the program. 3. Ingredient Adjuster A cookie recipe calls for the following ingredients: - 1.5 cups of sugar - 1 cup of butter - 2.75 cups of flour The recipe produces 48 cookies with this amount of the ingredients. Write a program that asks the user how many cookies he or she wants to make, then displays the number of cups of each ingredient needed for the specified number of cookies. 4. Male and Female Percentages Write a program that asks the user for the number of males and the number of females registered in a class. The program should display the percentage of males and females in the class. Hint: Suppose there are 8 males and 12 females in a class. There are 20 students in the class. The percentage of males can be calculated as: 820=0.4, or 40%. The percentage of females can be calculated as 12+20=0.6, or 60%

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

What are the reasons that corporations invest in securities?

Answered: 1 week ago

Question

14-18 Compare the two major types of planning and control tools.

Answered: 1 week ago