Skip to content
Sign upLog in
← Back to Community

Try this its working, any suggestions on how to make it more compact??

Profile icon
ShivamRastogi2

print("Welcome to the tip calculator!!")

bill_b = input("What was the total bill?" + " " + "$")

tip = input("What percentage tip would you like to give? + 10, 12, or 15? ")

tip1 = float(tip)

percentage = tip1/100 + 1

bill_amount = float(bill_b) * percentage

num_people = input("How many people to split the bill? ")

each_share = bill_amount/int(num_people)

r_ound = round(each_share, 2)

print(f"Each person shall pay: ${r_ound}")

Voters
Profile icon
Numan885
Profile icon
RtoonTV
Profile icon
AmoghTheCool
Profile icon
ShivamRastogi2
Comments
hotnewtop
Profile icon
ShivamRastogi2

Btw in the code line of what percentage tip you want you can put any amount except 10/12 or 15 its just for the purpose of the project I had to specify the tip amount