+ 1

Lesson 18 pyton beginners

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

10th Feb 2022, 1:45 PM
Mario Fiorino
8 Answers
+ 1
Thank you so much
10th Feb 2022, 3:40 PM
Mario Fiorino
0
What is the problem? Pls Add clear details... edit: Mario Fiorino code for this : 50*20.0/100=10.0 https://www.sololearn.com/Discuss/2975875/?ref=app if not solved, pls post your try here!!
10th Feb 2022, 2:02 PM
Jayakrishna 🇼🇳
0
1. Take input as float 2. Calculate the 20% of it 3. Print the calculated amount in 'float'
10th Feb 2022, 2:28 PM
NEZ
NEZ - avatar
0
bill = int(input()) tip=("100Ă·50%20") print("x") #your code goes here
10th Feb 2022, 3:27 PM
Mario Fiorino
0
I'm trying this
10th Feb 2022, 3:27 PM
Mario Fiorino
0
Mario Fiorino Why giving the output between " "?? It will always print the value: x And why printing x?? When you have taken tip = ... Then why printing x?? 1.Remove the "" from your code 2. To calculate 20% we do like this: (20/100)*50 (if we want to calculate 20% of 50) You have to just change the value from 50 to 'bill'. And use this: print(tip) // If you will get any problems again, then alert us
10th Feb 2022, 3:32 PM
NEZ
NEZ - avatar
0
bill = int(input()) #input is may be float, tip=("100Ă·50%20") " This is just a string, don't put in quotes "", and in systems / is the division symbol, not Ă· But you need to take input 'bill' , into calculations So tip = bill*20/100 #print("x") #this prints string x only, print tip print(tip) #put all together, take input as float, instead of int type bill=float ( input() )
10th Feb 2022, 3:36 PM
Jayakrishna 🇼🇳
0
I really appreciate it
10th Feb 2022, 3:40 PM
Mario Fiorino