Skip to content

error handling in unit conversion code #114

@rina136

Description

@rina136

add this code after taking user input to prevent error and it will show appropriate "invalid input" message
try:
value = float(input(f"Enter value in {from_unit}: "))
except ValueError:
print("Please enter a valid number!")
continue

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