Kaleidoscope | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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)

5th May 2023, 2:28 AM
Amy Joseph
Amy Joseph - avatar
8 Answers
+ 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))
5th May 2023, 3:02 AM
A͢J
A͢J - avatar
+ 1
Did your challenge solve?
6th May 2023, 6:57 AM
A͢J
A͢J - avatar
+ 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
6th May 2023, 12:01 PM
A͢J
A͢J - avatar
0
Thank you. Made it more difficult than it needed to be.
5th May 2023, 3:04 AM
Amy Joseph
Amy Joseph - avatar
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.
6th May 2023, 3:42 AM
Amy Joseph
Amy Joseph - avatar
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.
6th May 2023, 8:52 AM
Amy Joseph
Amy Joseph - avatar
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))
7th May 2023, 2:49 AM
Amy Joseph
Amy Joseph - avatar
0
Amy Joseph 2nd last line should be outside the if block You should clear your basic concepts
7th May 2023, 4:01 AM
A͢J
A͢J - avatar