Operator issue | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Operator issue

When you go out to eat, you always tip 20% of the bill amount. But whoā€™s got the time to calculate the right tip amount every time? Not you thatā€™s for sure! Youā€™re making a program to calculate tips and save some time. Your program needs to take the bill amount as input and output the tip as a float. Sample Input 50 Sample Output 10.0 Name= int(input()) Thatā€™s the program any idea how to solve?

11th May 2021, 1:07 PM
Sara_889
Sara_889 - avatar
10 Respostas
+ 2
Hey, pls show your attempt here that we can help... Happy Coding..
11th May 2021, 1:09 PM
SĆ¢Ć±tĆ“sh
SĆ¢Ć±tĆ“sh - avatar
+ 2
Sara_889 Bill=int(input("enter your bill amount")) Tip=Bill*20/100 print (float (Tip))šŸ˜
11th May 2021, 1:15 PM
SĆ¢Ć±tĆ“sh
SĆ¢Ć±tĆ“sh - avatar
+ 2
Sara_889 I can't understand your code Answer is zero correct due to you use modulus Operator That's use as 9%5 will give 4 12%2 will give 0
11th May 2021, 1:17 PM
SĆ¢Ć±tĆ“sh
SĆ¢Ć±tĆ“sh - avatar
+ 1
Thanks you just solved my isue i still begginer and facing some obstacles šŸ™
11th May 2021, 1:19 PM
Sara_889
Sara_889 - avatar
+ 1
Sara_889 your welcome Keep learning šŸ‘ŒšŸ˜ If any problem occurred during learning or coding just message me, I'll help as possible..
11th May 2021, 1:21 PM
SĆ¢Ć±tĆ“sh
SĆ¢Ć±tĆ“sh - avatar
0
Explanation: 20% of 50 is 10. To calculate 20% of a given amount, you can multiply the number by 20 and divide it by 100: 50*20/100 = 10.0 This is the question?
11th May 2021, 1:08 PM
Sara_889
Sara_889 - avatar
0
bil= int(input()) x= 100 x *= 10 x %=50 Print(x)
11th May 2021, 1:11 PM
Sara_889
Sara_889 - avatar
0
bill = int(input()) #your code goes here x= 100 x *= 100 x %=10 print(x) Still my output zero
11th May 2021, 1:15 PM
Sara_889
Sara_889 - avatar
0
Here's the code: print(int(input())/5) # Hope this helps
11th May 2021, 2:46 PM
Calvin Thomas
Calvin Thomas - avatar
0
bill = int(input()) print(float((bill / 100) * 20))
16th Dec 2022, 8:16 PM
ŠŃ€Ń‚ŃƒŃ€ ŠŠøŠŗŠ¾Š»Š°ŠµŠ²