Trying to assign a variable (gender) a "m" or "f" based on an if statement, but it's not working. Here's my code:
gender = input("Please enter your gender: ")
gender_char = gender[0:1]
if gender_char == "M" or "m":
gender = "m"
elif gender_char == "F" or "f" or "W" or "w"
gender = "f"
It defaults to M for some reason and I'm not sure why. I'm using the gender_char variable to basically ignore any misspellings that people input. For example: Femlea will always give gender_char an "f". The if-statement should then apply "f" to the variable gender. Any ideas?
Aucun commentaire:
Enregistrer un commentaire