Question: python intvert problem Write a pure function intvert (1st) that takes in a list of variable length and returns a new list containing every integer

python intvert problem

python intvert problem Write a pure function intvert (1st) that takes in

Write a pure function intvert (1st) that takes in a list of variable length and returns a new list containing every integer in the original list, but in reverse order. (So [1,2,3] becomes [3,2,1] )All other datatypes should be removed. If the list contains no integers, you should return an empty list. Some example interactions are shown below: >>> intvert ([1,2,3]) >>> intvert([5, "pineapple", 50.5, 1]) 1, 51 >>>intvert ([0.0, 1.3, "9"1) [ 1 It may help to use the type ) function to check the datatype of each item in the input list. Constraints/Comments The function should return a new list, rather than mutate the original list. You may assume that the user will enter a list, but you cannot assume that the list will be of a particular length, or contain any items at all You cannot assume the datatype of the elements of the input list. Test your program with strings, floats, nested lists, etc. Your return list must only contain the ints in the original list, no other types You must invert the given list manually, you cannot use the built-in.reverse) for this problem. Clarification (2/19): You may not use slice to reverse the list in a single

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!