Skip to content

set0 #4

Description

@rohit20032003

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()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions