0
Kaleidoscope
I’m not sure what I’m doing wrong. Frustration is getting to me. customer = input() price = 5.00 kaleidoscopes = int(customer) * int(price) discount = int(kaleidoscopes) - 0.10 add_tax = int(discount) * 0.70 if int(customer) >= kaleidoscopes: print(float(add_tax)) else: print(price)
8 Réponses
+ 3
Read instructions carefully
total = price * customer
#if customer is more than 1 then get 10% discount on total
if customer > 1:
total = total - total * 0.1
#add 7% tax on total
total = total + total * 0.07
print(round(total, 2))
+ 1
Did your challenge solve?
+ 1
Amy Joseph
Check my answer again what I said.
discount should be calculate when purchase is greater than 1 but you are doing before that
And don't convert total to int
and what is 0.35 here
and also tax should be calculate after discounted amount
0
Thank you. Made it more difficult than it needed to be.
0
The math isn’t correct. For 1, the price should be 5.35. It comes out differently when I work on it outside of the challenge (as a code bit). I don’t understand what is causing the difference in math.
0
Did not.
I tried to change the math but only opened first two.
I recieved errors with the above code - it said a float is not callable and total was not a function.
purchase = int(input())
price = 5.00
total = int(purchase * price)
one = total + .35
discount = one - .90
if purchase > 1:
print(discount)
else:
print(one)
This is how I currently have it.
0
Apologies for the confusion with the last code, this one works for all but the first. My output is 5.0 and it needs to be 5.35
customer = int(input())
price = 5.00
total = customer * price
if customer > 1:
total = total - (total * 0.1)
total = total + (total * 0.07)
print(round(total, 2))
0
Amy Joseph
2nd last line should be outside the if block
You should clear your basic concepts