Question: USE PYTHON PLEASE PART 1 Create a function without a parameter that prompts the user to enter their age. The function is to also add
USE PYTHON PLEASE
PART 1
- Create a function without a parameter that prompts the user to enter their age. The function is to also add 10.25 to the input value and return the calculated result. Afterwards, be sure to call the function and enter a value to show the functions output.
- Create a function that returns the first five elements of a list with ten float and integer values. Afterwards, call the function by passing in the list.
- Create a function that returns all string elements in the list to lowercase: [UNIteD sTATES, InDIA, BRaZIL, rUSsIA, PERU]. Call the function by passing in the list as an argument. Hint: you will use a for statement inside your user-defined function to iterate on each item in the list.
PART 2
Instructions: Complete the three problems below. Create your own variables as needed.
- Create a function that passes in a list variable as an argument. The user-defined function will find the maximum and minimum values using pythons built-in functions to compute the difference to obtain the range value. The function must display the following:
The list contains __ elements.
The maximum value is __.
The minimum value is __.
The range value is __.
Then call the function.
Note: Do not use the numpy package.
PART 3
Instructions: Create a function that references the confirmed_cases list provided below. The function should iterate on the list, and if an element is a numeric data type (integer or float), then store its index position to a separate list that stores numeric values only. If an element is not a numeric data type, then store its index position to a separate list that stores non-numeric values.
Use this list: confirmed_cases = [US, 23.3, India, 10.9, 9.9, 4.3, Russia, 4.1, Peru, 1.2]
Pseudocode:
Initialize confirmed_cases
Initialize a list that will store each numeric valuess index
Initialize a list that will store each non-numeric values index
Define a function that will pass in one parameter
For each element in the enumerated list of confirmed cases
If the element instance is an integer or float
Include the elements index to the list for numeric types
Else include the elements index to the list for non-numeric types
Display the list with indexes related to the numeric values
Display the list with indexes related to the non-numeric values
Call the function
Notes:
- Call the function passing confirmed_cases as an argument.
- This problem will require that you research the documentation for the isinstance() and enumerate() functions. First get familiar with how to use them before including them inside the user-defined function.
- Do not sort or modify the order of the confirmed_cases list.
PART 4
Create a function that prompts the user to enter two grades that will return the average grade. Round the result to two decimal places using the round function. Next, create a function that references the average grade to check if it is considered passing or not. Assume a passing grade is at least 73 and the function only needs to return the Passed or Not Passed. Call both functions.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
