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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!