Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help in python Safari 1:29 e.edu aE CSC 131 Computational Thinking Lab 2 The purpose of this lab is to practice working with Python's

Please help in python image text in transcribed
Safari 1:29 e.edu aE CSC 131 Computational Thinking Lab 2 The purpose of this lab is to practice working with Python's higher order functions and ternary operator. Write all of your code in onc file named lab2.py. You can write the code for items 1 through 6 directly inside the main function. . II point] Using the map function and a lambda argument, write an expression that produces a list of the cubes of the values in a. Assign the result to a variable called m and print m. rl. The output from this step is the string '12345678910 4. I1 point] Use a list comprehension to produce the same list as in question 1 Gc., the new li 6. Il point Uise a list compeesin to produc a s costaining the cubes of the al in that ae divisible by 3. The ousrh sp is the lise 127,216, 729 7. 12 points) Write a function named evenFilter that takes as an argument a dictionary of elements indexed by integer keys. Using only a list print f 3. il point] Using the reduce function and a lambda argument, write an expression that returns the resalt of concating all the digits in a. Assign the result to a variable called rl and print st will contain the cubes of the values in a) elements associated with the keys that are evenly divisible by 2. For example, data ( one3 ehree print (even 1lter (data)) ouse return the values of the t'four, "eight'ten eiht, 10: te 8. 12 points) Write a function named tinaxincx, y) t main function to test the evenrlter function that uses the ternary operator (ie, conditional expression) to find and return the minimum of its two aguments. Assume that x and y name and the name of your TRACE folder at the top of the filke in a docstring. When you are done, demonstrate your code to the instructor are numbers. Add code to main to test this function. Name your file lab2 py, Make sure to include your and upload your solution in your CSC131 upload folder in a folder called LABSab2

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

Students also viewed these Databases questions