Question

In: Computer Science

Write code that takes the size of their foot from user and prints out suggested sandal...

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.

Solutions

Expert Solution

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!


Related Solutions

Write a program which prompts the user for a positive integer, and then prints out the...
Write a program which prompts the user for a positive integer, and then prints out the prime factorization of their response. Do not import anything other than the Scanner. One way you might go about this using nested loops: Start a "factor" variable at 2 In a loop: repeatedly print the current factor, and divide the user input by it, until the user input is no longer divisible by the factor increment the factor This plan is by no stretch...
Write a class to accept a sentence from the user and prints a new word in...
Write a class to accept a sentence from the user and prints a new word in a terminal formed out of the third letter of each word. For example, the input line “Mangoes are delivered after midnight” would produce “neltd”. Program Style : Basic Java Programming
Write a program that prompts a user for an integer from 1 to 99 and prints...
Write a program that prompts a user for an integer from 1 to 99 and prints it as an amount in words. The program will loop in case the user wants to input an additional number. If the user enters -99, the program will exit. Example: Input: 89 Output: Eighty nine Input: 45 Output: Fourty five Input: -99 Output: Have a nice day. <program exits> For this project, you are to: 1) You should validate any data coming from the...
Write a program that prompts a user for an integer from 1 to 99 and prints...
Write a program that prompts a user for an integer from 1 to 99 and prints it as an amount in words. The program will loop in case the user wants to input an additional number. If the user enters -99, the program will exit. Example: Input: 89 Output: Eighty nine Input: 45 Output: Fourty five Input: -99 Output: Have a nice day. <program exits> c++ project. need help.
Java Code: Write an application that takes in user input. (Name, Age, and Salary) ------ Write...
Java Code: Write an application that takes in user input. (Name, Age, and Salary) ------ Write an application that includes a constructor, user input, and operators.
Write out code for a nested if statement that allows a user to enter in a...
Write out code for a nested if statement that allows a user to enter in a product name, store the product into a variable called product name and checks to see if that product exists in your nested if statement. You must include 5 product names to search for. If it is then assign the price of the item to a variable called amount and then print the product name and the cost of the product to the console. If...
1. Write a shell code that prints the integers from 80-90 2. Write a shell code...
1. Write a shell code that prints the integers from 80-90 2. Write a shell code that prints the sum of odd integers that are inputted by the user 3. Write a shell code that reads a set of integers {125, 0, 122, 129, 0, 117} and prints {125, 122, 129, 117} Programming Language: Linux
Write a function which takes one parameter int num, and prints out a countdown timer with...
Write a function which takes one parameter int num, and prints out a countdown timer with minutes and seconds separated by a colon (:). It should print out one line for each second elapsed and then pause one second before printing out the next line. A few things to note: - You can assume that calling the function usleep(1000000) makes the program pause for one second - It should count down from num minutes:zero seconds to zero minutes:zero seconds -...
Write a Java method called printAvg that takes in two floating point numbers and prints out...
Write a Java method called printAvg that takes in two floating point numbers and prints out the average of them.
Write a program that uses a while statement to read integers from the user and prints...
Write a program that uses a while statement to read integers from the user and prints the sum, average, and largest of these numbers. The input should terminate if the user enters 999. The average should be output with 4 digits of precision. c++ please ASAP
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT