Question
Greetings I need to get this output Total price for one book: 17.97 Total price for two books: 33.69 Total price for 60 books: 945.45
Greetings
I need to get this output
Total price for one book: 17.97 Total price for two books: 33.69 Total price for 60 books: 945.45 Total price for zero books: 0
but note that you need to use some form of branching condition to get the last case to work.
My code so far.... I get the 1 book and the zero, but not the two or 60.
def total_price(n): book_price = 24.95 discount = 0.60 shipping_price_many = 0.75 shipping_price = 3.00
if n == 0: return 0
total_price = book_price * discount + shipping_price return total_price
print("Total price for one book:", total_price(1)) print("Total price for two books:", total_price(2)) print("Total price for 60 books:", total_price(60)) print("Total price for zero books:", total_price(0))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started