Question: In this question you will practice passing lists as parameters to a function. Your goal is to write a function definition for: Smartsquare ( inlist

In this question you will practice passing lists as parameters to a function. Your goal is to write a function definition for: Smartsquare (inlist, inplace). Parameter inlist is a list of integers and the parameter inplace is a boolean with a value True or False. The function proceeds as follows:
If inplace is True, SmartSquare replaces the numbers in the parameter inlist with their squares. (The list in the calling program will change). The function also returns a list with squares of the numbers of the original list.
If inplace is False, SmartSquare returns a list containing the squares of values of the numbers in inlist. The inlist itself is not changed.
Here are some sample runs:will print
[4,121,49][4,121,49]
Another run:
mylist =[2,11,7]
In this question you will practice passing lists

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 Programming Questions!