cs50python
cs50python copied to clipboard
set0
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()
hi @rohit20032003 have the assignments changed?