Answers for "python his/her"

-5

python his/her

def user_info():
    name = input("Name = ")
    try:
        age = int(input("Age = "))
    except ValueError:
        exit("Invalid value! Age can only be a numerical value!")
    color = input("Favorite Colour = ")
    gender = input("Gender = ")
    if gender is ["Male", "male", "M", "m"]:
        his_her = "his"
    elif gender is ["Female", "female", "F", "f"]:
        his_her = "her"
    print(f"{name} is {age} years old and {his_her} favorite colour is {color}.")


user_info()
Posted by: Guest on January-15-2021

Code answers related to "python his/her"

Python Answers by Framework

Browse Popular Code Answers by Language