Could you please tell me what's a better way of writing this Python code? Kaleidoscopes exercise..
So as you can see I'm a total beginner.. one of my exercises that I worked on is Kaleidoscopes. Here if a customer buys more than one, they get a 10% discount on all of them, otherwise they pay whole price. The price for each one is 5.00. They also pay tax which is 7%.. I have done it correctly and we can get the desired output, but I feel that the code I wrote could have been written better or in a shorter way. Can you suggest any modifications please? Here's the code: kaleidoscopes_bought=int(input('Number of Kaleidoscopes: ')) total_price=(5*kaleidoscopes_bought) if kaleidoscopes_bought>1: discount=(total_price*10)/100 new_price=total_price-discount tax=(7*new_price)/100 whole_payment=new_price+tax print("discounted price + tax:
quot;,float(whole_payment)) else: whole_price=total_price+7*total_price/100 print("whole price+tax: quot;,float(whole_price))