Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python s/content/818919/viewContent/8490967/View 5.) Write a function called pants size that has a single parameter (the value will be an integer) representing a person's waist size
python
s/content/818919/viewContent/8490967/View 5.) Write a function called pants size that has a single parameter (the value will be an integer) representing a person's waist size in inches. The function returns a string. The string returned will be either "small","medium", or "large" depending on the parameter value. Waist measurements that are 34 inches or larger should return large. Measurements that are 30 inches or larger, but not large enough to be in the large category, should return medium. Anything smaller should return small. Here are some examples of calling the function with different arguments. The code executed is in blue, the value returned by the function is in green) pants_size (38) pants_size (34) pants size (33) pants_size (29) pants_size (-20) pants size (2000) --> --> --> --> --> --> "large large 'medium 'small 'small "large 6.) Write a function called pants fitter that takes no arguments. The function should first ask the user for his/her name. It then greets the user by name. Next it asks the user for his/her waist size in inches (a positive integer). It then asks the user how many pairs of pants he/she would like to buy a positive integer). Next it asks what type of pants the user wants to buy (either "regular" or "fancy"). Next it calculates the cost of the pants (integer). Regular pants cost $40 per pair. Fancy pants cost $100 per pair. Finally it prints out the number of pairs, the size, the type, and the total cost. The following examples show the format that your prompts and output should be in. This function should use the function you wrote in the previous question Here are some examples of calling the function with different arguments. (The code executed is in blue, the output produced is in green, and user input is in red): pants fitter() Enter your name: Ziggy Greetings Ziggy welcome to Pants-R-Us Enter your waist size in inches: 34 How many pairs of pants would you like: 2 Would you like regular or fancy pants? fancy 2 pairs of large fancy pants: $ 200 pants_fitter() Enter your name : Elmer Greetings Ziggy welcome to Pants-R-Us Enter your waist size in inches: 31 How many pairs of pants would you like: 10 Would you like regular or fancy pants? regular 10 pairs of medium regular pants: $ 400 pants_fitter() Enter your name: Minnie Greetings Ziggy welcome to Pants-R-Us Enter your waist size in inches: 12 How many pairs of pants would you like: 1 Would you like regular or fancy pants? fancy 1 pairs of small fancy pants: $ 100 duy /content/81831 ViewContent/349095T/View 7.) Write a function called digdug that takes a single argument number (assume it will always be a positive integer). For every integer from 1 up to and including number, the function will print a message if warranted. If the integer is evenly divisible by 3 the function will print "dig". If the integer is evenly divisible by 5 it prints "dug". If the integer is evenly divisible by both 3 and 5 it prints "digdug". If the integer is not divisible by either 3 or 5 it does not print anything Here are some examples of calling the function with different arguments. The code executed is in blue, the output produced is in green): digdug (2) digdug (3) 3 : dig digdug (5) 3: dig 5 dug digdug (15) 3 : dig 5 : dug 6 : dig 9: dig 10 : dug 12 : dig 15 : digdug edude/content. com /4901 8.) Write a function called beef type that takes a single parameter, percent lean. If the value of percent_lean is less than 78%, return "Hamburger". If it is at least 78% and less than 85%, then return "Chuck". At least 85% but less than 90% return "Round". 90-95% inclusive return "Sirloin". if percent lean doesn't fall within one of these ranges, return "Unknown". Here are some examples of calling the function with different arguments. (The code executed is in blue, the value returned by the function is in green): beef type (91.2) --> "Sirloin" beef_type (78) --> "Chuck" beef_type (87) --> "Round" beef type (95.1) --> "Unknown 9.) Write a function called species height that takes 2 arguments. The first is either "Human" or "Klingon". The second is a positive float representing the height (in inches) of this human or Klingon. In this homework assignment, the average human height is 67 inches. The average Klingon height is 71 inches. For the parameters given, print out if it is above, below or at the average height for its species. Here are some examples of calling the function with different arguments. The code executed is in blue, the output produced is in green): species height("Human", 62.1) Below Average species_height("Klingon", 73) Above Average species_height("Klingon ", 71) Average 10.) Write a function called sooner date that has 4 integer parameters. The first is a number between 1 and 12 (inclusive) that represents a month. 1 is January, 2 is February, etc. The second is a number between 1 and 31 (inclusive) that represents a day. The third parameter is another integer representing a month and the fourth is another integer parameter representing a day. So essentially you have 2 dates (the first 2 parameters and the second 2 parameters). Figure out which date would come sooner, then print out that date in the format month / day Here are some examples of calling the function with different arguments. The code executed is in blue, the output produced is in green): sooner_date(1, 1, 1, 2) 1 / 1 sooner_date (2, 5, 1, 3) 1 / 3 sooner_date(8, 25, 7, 30) 7 / 30Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started