Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using python 1. A bakery sells loaves of bread for $3.49 each. Day old bread is discounted by 60 percent. Write a program that begins

image text in transcribed

using python

1. A bakery sells loaves of bread for $3.49 each. Day old bread is discounted by 60 percent. Write a program that begins by reading the number of loaves of day old bread being purchased from the user. Then your program should display the total price. All of the values should be displayed using two decimal places, and the decimal points in all of the numbers should be aligned when reasonable values are entered by the user. a. Write a function that calculates the total price of the bread. It should take the number of loaves as an input and return the total price. b. Make sure your input is an integer 2. Develop a program that reads a four-digit integer from the user and displays the sum of the digits in the number. For example, if the user enters 3141 then your program should display 3 + 1+ 4+ 1 = 9. a. Write a function that calculates the total. It should take the number as an input and return the sum of digits. b. Make sure your input is an integer

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

Students also viewed these Databases questions