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 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
Certainly Here are the functions you requested def listIncinpu... View full answer
Get step-by-step solutions from verified subject matter experts
