+ 1

Someone Help me fix the error

print("calculation of total cost after discount") n = input("enter the cost") a = int(n) answer=0.9*a print("the final cost is", answer)

18th Aug 2019, 6:46 AM
Ankush Raj
Ankush Raj - avatar
2 Respostas
+ 3
The right way to input n is n=eval(input("enter the cost:")) where eval get your input
18th Aug 2019, 7:01 AM
独孤求败
独孤求败 - avatar
+ 1
?? Can't see an error exactly but here how I would write the code;- print("calculation of total cost after discount") n = int(input("enter the cost:-")) answer = 0.9 * n # this give you 10% discount. # or answer = n - (0.9 * n) if the 0.9 is the discount # (90%). print(answer)
18th Aug 2019, 10:26 AM
rodwynnejones
rodwynnejones - avatar