- 3

Hello world. Can't solve the problem 20 in Python for beginners. Help 🆘

31st Jul 2021, 9:27 AM
Taras Ishchuk
Taras Ishchuk - avatar
12 Antworten
+ 1
bill = int(input()) tip = 20 print(bill*(tip/100) hope this will help you
1st Aug 2021, 8:24 AM
Adarsh Addee
Adarsh Addee - avatar
+ 5
bill = int(input()) print (bill/5) (Divide by 5 cuz it is the same as *20%)
31st Jul 2021, 9:49 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
+ 2
Please post the problem and your code here
31st Jul 2021, 9:31 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
0
bill = int(input()) x=50 y=20 print(x=50*20/100)
31st Jul 2021, 9:43 AM
Taras Ishchuk
Taras Ishchuk - avatar
0
What is the task?
31st Jul 2021, 9:45 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
0
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
31st Jul 2021, 9:46 AM
Taras Ishchuk
Taras Ishchuk - 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
31st Jul 2021, 9:47 AM
Taras Ishchuk
Taras Ishchuk - avatar
0
So in this problem you just need to output 20% of the bill. Which is "print(bill*20/100)". But 20/100 = 1/5, so "print(bill/5)" will work 😁
31st Jul 2021, 9:53 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
0
Ok, точно! Спасибо большое! Работает. А что если процент чаевых например 13,5%
31st Jul 2021, 9:55 AM
Taras Ishchuk
Taras Ishchuk - avatar
0
print(bill*13.5/100)?
31st Jul 2021, 9:56 AM
Taras Ishchuk
Taras Ishchuk - avatar
0
Ну тогда bill*13.5/100 😁
31st Jul 2021, 9:57 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
0
👍а я все усложнял(
31st Jul 2021, 9:57 AM
Taras Ishchuk
Taras Ishchuk - avatar