In: Computer Science
Write code that takes the size of their foot from user and prints out suggested sandal size.
Shoe Range | Sandal Size |
---|---|
<= 5 (inclusive) | Small |
5 ~ 9 (inclusive) | Medium |
9 ~ 12 (inclusive) | Large |
above 12 | X-Large |
example: Please enter your shoe size: (user types 6.5)
Your sandal size is Medium.
Explanation:
Here is the code which has the size of the shoe as input and then it uses an if elif condition to check the value entered by the user and then prints the size as Small, Medium, Large, X-Large.
Code:
size = float(input("Please enter your shoe size: "))
if(size<=5):
print("Your sandal size is Small.")
elif(size<=9):
print("Your sandal size is Medium.")
elif(size<=12):
print("Your sandal size is Large.")
else:
print("Your sandal size is X-Large.")
Output:
PLEASE UPVOTE IF YOU FOUND THIS HELPFUL!
PLEASE COMMENT IF YOU NEED ANY HELP!