You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
correct codes
def main():
user_input = input("Please enter some text: ")
print(user_input.lower())
if name == "main":
main()
tip
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):
# Remove the leading $ and convert to float
return float(d.replace("$", ""))
def percent_to_float(p):
# Remove the trailing % and convert to float, then divide by 100 to get the decimal value
return float(p.replace("%", "")) / 100
main()
The text was updated successfully, but these errors were encountered:
indoor
indoor.py
correct codes
def main():
user_input = input("Please enter some text: ")
print(user_input.lower())
if name == "main":
main()
tip
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):
# Remove the leading $ and convert to float
return float(d.replace("$", ""))
def percent_to_float(p):
# Remove the trailing % and convert to float, then divide by 100 to get the decimal value
return float(p.replace("%", "")) / 100
main()
The text was updated successfully, but these errors were encountered: