1. Engineering
  2. Computer Science
  3. program language python 3...

Question: program language python 3...

Question details

program language: python 3.

Purpose To write a function that accepts input from the user, performs a task and returns an answer Degree of Difficulty: Easy In assignment 1, you created your veryfirst Mad Lib. Recall that a Mad Lib is a word game that usesphrases, whereoneplayer prompts others for a list of words to substitute for blanksinastory. You are going to create another one to practice writing functions and using arguments and return values. Your task is to write a Python function named mad_lib which takes three parameters as input and returns your story. Two of the parameters should be integers and the third should be a string. Ask the user to input values for each of the function arguments from the console. The input text from the console MUST happen OUTSIDE of the mad_lib function, and themad lib function should return a single string that makes up the ENTIRE story. You may assume that the user supplies valid input. Call the mad_lib function with the arguments you read from the console and output its return value to the console. Your story, the output of your function, should include the following . The string argument . The length of the string argument The first integer argument . The second integer argument converted to float Include an appropriate docstring which states the functions purpose. parameters), and return valuels Sample Run Here is an example of how your programs console output might look. Green text was entered by the user, blue text came from data returned by the mad_lib function Enter an integer: 15 And another integer: 72 What is your favorite Pokemon characker: Pikachu Pikachu is a friendly rodent that veighs 72.0kg. It has 7 siblings and its birthday is in 15 days In the example above, the second integer argument, 72, was converted to a floating point value 72.0 in the output displayed on the console, while 7 represents the length of the string argument, Pikachu What to Hand In Hand in your solution in a file called a2q2.py Evaluation 4 marks for correct function header (name and parameters) 1 mark for reading inputs from the console 1 mark for appropriate doscstring 4 marks for correct return value printed on the console (as described above)

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution