Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program with a function named laser. If the laser function is called with any number of numerical arguments, it should return a list

image text in transcribed
Write a program with a function named laser. If the laser function is called with any number of numerical arguments, it should return a list containing all of the arguments greater than 7 and also return a list containing the squares of the first, third, fifth, ..., and so on arguments. To receive any credit, the function must use list comprehensions and must NOT use any for loop, while loop, or if statement. For example, the function calls: laser( ) laser(9) laser(3, 2) laser(15, 44, 22) laser(5, 8, 9, 11) laser(4, 2, 22, 9, 15) laser(10, 1, 22,9, 5, 76, 25, 81, 10) return the following expressions: ([],[]) ([9],[81]) ([],[9]) ([15, 44, 22], [225,484]) ([8, 9, 11], [25,81]) ([22, 9, 15], [16,484,225]) ([10, 22, 9, 76, 25, 81, 10], [100,484,25,625,100])

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions