Abstracting Decisions and Validation. Like with calculations, any logical task in a program can be represented by a function. You will design a new version of the program you created below. This new version will define and use functions for validating the user input, and looking up the value that corresponds to that valid input.  Your program shall: Define a function that returns a valid user input. This function will use a while loop to make sure the sure the user enters a valid value. Define a function that accepts the user input as a paramter, uses the decision structure of the program you created in program below to return the value associated to that input. Use a meaningful name for the functions above. Define a function main() to drive the functionality of the program as it is used throughout Chapter 6 of the textbook. Run and test the program to make sure it works correctly

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Abstracting Decisions and Validation. Like with calculations, any logical task in a program can be represented by a function.

You will design a new version of the program you created below. This new version will define and use functions for validating the user input, and looking up the value that corresponds to that valid input. 

Your program shall:

  • Define a function that returns a valid user input. This function will use a while loop to make sure the sure the user enters a valid value.
  • Define a function that accepts the user input as a paramter, uses the decision structure of the program you created in program below to return the value associated to that input.
  • Use a meaningful name for the functions above.
  • Define a function main() to drive the functionality of the program as it is used throughout Chapter 6 of the textbook.
  • Run and test the program to make sure it works correctly

 

 


Summary
The program calculate a waist measurement in inches, and
prints the corresponding pant size. If the input value is outside
the table, the program shall display “No size available".
'''

#Display each size of the pants

print("Please choose size of the pants between 26(XS) inches to 42(XXL) inches")


SizeOfPants = int(input("What pants size you are looking for"))

if 26<= SizeOfPants < 28:
print("Size is XXS")

elif 28<= SizeOfPants < 30:
print("Size is XS")

elif 30<= SizeOfPants <32:
print("Your size is S")

elif 32<= SizeOfPants <34:
print("Size is M")

elif 36<= SizeOfPants < 38:
print("Your size is L")

elif 38<= SizeOfPants <40:
print("Size is XL")

elif 40<= SizeOfPants < 42:
print("Size is XXL")

else:
print("No size Available.")

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY