Preparing git repo for final project
This commit is contained in:
17
problems/pset0/tip/tip.py
Normal file
17
problems/pset0/tip/tip.py
Normal file
@@ -0,0 +1,17 @@
|
||||
def main():
|
||||
dollars = dollars_to_float(input("How much was the meal? "))
|
||||
percent = percent_to_float(input("What percentage would you like to tip? "))
|
||||
tip = dollars * percent
|
||||
print(f"Leave ${tip:.2f}")
|
||||
|
||||
|
||||
def dollars_to_float(d):
|
||||
return float(d[1:])
|
||||
|
||||
|
||||
def percent_to_float(p):
|
||||
return float(p[:-1])/100
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user