Question: 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
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
Get step-by-step solutions from verified subject matter experts
