Has anyone made lesson 18 code project(tip calculator) of PYTHON FOR BEGGINERS. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Has anyone made lesson 18 code project(tip calculator) of PYTHON FOR BEGGINERS.

Please help me regarding this I tried many times but failed in it

13th Jan 2022, 1:29 PM
IDIOT KID
IDIOT KID - avatar
8 Answers
+ 2
Tip calculator is very easy problem, see what you have to do: Take a input (a number), now simply print the 20% of that, for example: if I input 100 you have to print the 20% of 100 that is 20. And yes, you will not get any help from the community till you show us your attempt (attach the code to this question or copy paste it here).
13th Jan 2022, 2:00 PM
NEZ
NEZ - avatar
0
THERE ARE THREE TEST CASES. I CAN'T SOLVE ALL OF THOSE AT A TIME. I USE THIS CODE bill = int(input()) print(float(125/5)) print(float(268/5))
14th Jan 2022, 6:31 AM
IDIOT KID
IDIOT KID - avatar
0
You have to make such a code that will be accepted for all values not for just these. For example: we have to add 8 and 5, we can do: ... print (8+5) ... but more effective way to add two numbers is: x=int(input()) y=int(input()) print (x+y) Now if you want to input a 'integer' then you can do: ...=int(input()) And for float: ...=float(input()) And for calculating percentage of a number you can see the given example: 50% of 60: (50/100)*60=30 now use your Logic how you will do this in Python (change 50 to 20). INDEPENDENT
14th Jan 2022, 8:19 AM
NEZ
NEZ - avatar
0
I HAD TRIED SO MANY TIMES. CAN YOU SEND ME THE CODE. PLEASE
14th Jan 2022, 8:45 AM
IDIOT KID
IDIOT KID - avatar
0
print(0.2*int(input())) #(It's one-liner code but the logic is same)
14th Jan 2022, 8:54 AM
NEZ
NEZ - avatar
0
THIS CODE IS ALSO NOT WORKING BROO. WAIT 0.2*int IS THIS POSSIBLE ??? THIS QUESTION MADE ME FREAK OUT YRR. HOW I ANSWER IT 🥺🥺🥺🥺
15th Jan 2022, 6:22 PM
IDIOT KID
IDIOT KID - avatar
0
Its working fine🙄 Ya its possible to do that. Okay then, if that is not working you can split this code: bill=int(input()) print ((20/100)*bill)
16th Jan 2022, 3:38 AM
NEZ
NEZ - avatar
0
THANKS BROOO IT WORKED I HAVE BEEN VERY TENSED ABOUT IT THANK YOU VERY MUCH BROOO.
16th Jan 2022, 6:29 PM
IDIOT KID
IDIOT KID - avatar