Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions

Question

What is shop floor control?

Answered: 1 week ago