0

Went in resturant give tip 20% .Your program take bill amount as input & output tip as float. Sample Input ( 50)& output (10.0

Went in resturant give tip 20% .Your program needs to take the bill amount as input and output the tip as a float. Sample Input 50 Sample Output 10.0 This program is from python beginner code 2 or code 3 plz help

6th Sep 2021, 5:09 AM
PRIYANSHU GOYAL
PRIYANSHU GOYAL - avatar
8 odpowiedzi
+ 4
Please post your attempt to help us help you
6th Sep 2021, 5:15 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 4
You need to write a code that will work for any input not one code for each test case. All you need to declare bill as input variable and multiply it with 20% means 20/100
6th Sep 2021, 5:17 AM
Simba
Simba - avatar
+ 2
Sandeepkumar Arisella I am sure that PRIYANSHU GOYAL appreciates you supplying the answer, now he doesn't need to think for himself at all. Which means he will probably not learn anything either. Perhaps, if you attached a description of how your code works, he may take the time to read it & possibly learn something.
6th Sep 2021, 8:12 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
Sandeepkumar Arisella Good intentions I have also done the same but now I try to attach an explanation with it. You have a good heart
6th Sep 2021, 10:09 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
# You can use this :(if input always an integer # Use try/except block to handle any errors print(0.2*int(input()))
7th Sep 2021, 5:30 AM
Kartikey Kumar
Kartikey Kumar - avatar
+ 1
# Check this code for your problem bill = int(input()) #your code goes here tip = float(bill*0.20) print (tip)
6th Sep 2021, 7:53 AM
Sandeepkumar Arisella
Sandeepkumar Arisella - avatar
+ 1
Hello Rik Wittkopp thanks for reminding me,but I thought he might learn from code, that is why I posted the code
6th Sep 2021, 8:17 AM
Sandeepkumar Arisella
Sandeepkumar Arisella - avatar
0
I write a lot
6th Sep 2021, 5:50 AM
PRIYANSHU GOYAL
PRIYANSHU GOYAL - avatar