Question
Write the function typeMatters(par) that takes in an arbitrary parameter called par that is of an arbitrary type and returns a different a different effect
Write the function typeMatters(par) that takes in an arbitrary parameter called par that is of an arbitrary type and returns a different a different effect depending on the type of par.
If par is a string: return the string repeated s number of times equal to the length of par.
If par is an integer: return a string that is the representation of each integer 1 through par followed by a space.
If par is a float: return a string that says I am a float of value: followed by par.
If par is a list: return par sorted and reversed.
If par is none of the types listed: return a string that says I am not a string, int, float, or list.
Sample Input Sample Output Hints
par = hello hellohellohellohellohello 5 times hello
par = 8 1 2 3 4 5 6 7 8 8 is an int
par = 5.634 I am a float of value: 5.634 5.634 is a float
par = [23, 8, 4, 16, 15, 42] [43, 23, 16, 15, 8, 4] Reverse sorted list
par = (3, 4) I am not a string, int, float, or list. It is a tup
Python Answer only because this is my current course!
Step 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