Question: 6.22 LAB: Operations on Random Numbers Write functions ran(), par(), even(), odd() where ran() returns a list of 50 random numbers, par() which checks for
6.22 LAB: Operations on Random Numbers Write functions ran(), par(), even(), odd() where ran() returns a list of 50 random numbers, par() which checks for the parity of the numbers, even() returns the number divided by 2, and odd() returns the number subtracted by 1. Print the modified list. Ex: Generated list with random numbers: [89, 29, 24, 91, 95, 23, 47, 12, 23, 11, 47, 59, 97, 57, 64, 50, 96, 17, 36, 81, 23, 55, 45, 60, 8, 12, 12, 33, 42, 50, 33, 11, 77, 19, 79, 33, 44, 49, 81, 96, 21, 65, 85, 18, 84, 73, 35, 17, 41, 62] Printed output: [88, 28, 12, 90, 94, 22, 46, 6, 22, 10, 46, 58, 96, 56, 32, 25, 48, 16, 18, 80, 22, 54, 44, 30, 4, 6, 6, 32, 21, 25, 32, 10, 76, 18, 78, 32, 22, 48, 80, 48, 20, 64, 84, 9, 42, 72, 34, 16, 40, 31]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
