- 1
What mistake I have made in this code for question given below. bill = int(input()) x=float((bill*20)//100) print(x)
Q was to take input from user for bill of order and calculate 20% tip on it in float
3 ответов
+ 6
x=float((bill*20)/100)
+ 6
Yes, but decimals will be lost(truncated) if we use floor division(//) instead of division operator(/)
x = 8*20/100
y = 8*20//100
print(float(x))
print(float(y))
- 1
but to get the quotient shouldn't we have put //