Question: 2. Write a function called listInc that accepts a list of integers as an input parameter and returns a copy of the input list

2. Write a function called listInc that accepts a list of integers as an input parameter and returns a copy

2. Write a function called listInc that accepts a list of integers as an input parameter and returns a copy of the input list where each integer has been incremented by 1. Do it using a list comprehension. Examples: a. listInc ([7,2,4,8]) will return [8,3,5,9] b. listInc ([9,-1,0.0,5]) will return [10,0,6] Use list comprehension to create the list returned by the function. 3. Write a function called listout that accepts a list of items as an input parameter and prints each item in the list on a separate line. For example: listOut ( [7,2, 'OK',8]) will print... 7 2 8 Can you do this with a list comprehension? (The answer is yes. Show how.)

Step by Step Solution

3.32 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Certainly Here are the functions you requested def listIncinpu... View full answer

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!