Sep-14-2018, 06:39 PM
Hello.
I'm trying to write a program that calculates the total price of photocopies made at a photocpy business.
Prices are as follows:
The first ten are at 10 cents
The next 20 are at 9 cents
The rest are at 8 cents.
This is what I have done:
------------------------------------------------------
n = int(input("Number of copies: "))
Number of copies: 50
total_price = float
if (n <= 10):
total_price = n * .10
elif (n <= 30):
total_price = 10 * .10 + (n - 10) * .09
else:
total_price = 10 * .10 + 20 * .09 + (n - 30) * .08
print("The total price is", total_price)
------------------------------------------------------
I'm getting the following:
The total price is <class 'float'>
Would you please help?
Thank you!
I'm trying to write a program that calculates the total price of photocopies made at a photocpy business.
Prices are as follows:
The first ten are at 10 cents
The next 20 are at 9 cents
The rest are at 8 cents.
This is what I have done:
------------------------------------------------------
n = int(input("Number of copies: "))
Number of copies: 50
total_price = float
if (n <= 10):
total_price = n * .10
elif (n <= 30):
total_price = 10 * .10 + (n - 10) * .09
else:
total_price = 10 * .10 + 20 * .09 + (n - 30) * .08
print("The total price is", total_price)
------------------------------------------------------
I'm getting the following:
The total price is <class 'float'>
Would you please help?
Thank you!