Queer European MD passionate about IT

tip.py 364 B

1234567891011121314151617
  1. def main():
  2. dollars = dollars_to_float(input("How much was the meal? "))
  3. percent = percent_to_float(input("What percentage would you like to tip? "))
  4. tip = dollars * percent
  5. print(f"Leave ${tip:.2f}")
  6. def dollars_to_float(d):
  7. return float(d[1:])
  8. def percent_to_float(p):
  9. return float(p[:-1])/100
  10. if __name__ == "__main__":
  11. main()