5. Dictionary-Returned Function a) Define a function, dictSqrt0 with a parameter, x: 1) Create a list, num and uses a loop to store, x numbers into the list in the range of (0, x). 2) Create a list,...


need help with python.


5. Dictionary-Returned Function<br>a) Define a function, dictSqrt0 with a parameter, x:<br>1) Create a list, num and uses a loop to store, x numbers into the list in the range of (0, x).<br>2) Create a list, sqrtNum and store all sqrt of the numbers saved in the list above.<br>3) Use dict) and zip) to create a dictionary, sqrtDict, as the return value with numbers as the keys and their<br>corresponding sqrt as the values.<br>b) Define a main() function to do the following:<br>1) Get a random integer, n, in the range (1, 10).<br>2) Call dictSqrt() with the argument and print the returned dictionary.<br>c) Call main() function to initiate the tasks to be performed.<br>Example Output<br>dictSqrt (3) will print the following:<br>{0:0, 1:1, 2:1}<br>

Extracted text: 5. Dictionary-Returned Function a) Define a function, dictSqrt0 with a parameter, x: 1) Create a list, num and uses a loop to store, x numbers into the list in the range of (0, x). 2) Create a list, sqrtNum and store all sqrt of the numbers saved in the list above. 3) Use dict) and zip) to create a dictionary, sqrtDict, as the return value with numbers as the keys and their corresponding sqrt as the values. b) Define a main() function to do the following: 1) Get a random integer, n, in the range (1, 10). 2) Call dictSqrt() with the argument and print the returned dictionary. c) Call main() function to initiate the tasks to be performed. Example Output dictSqrt (3) will print the following: {0:0, 1:1, 2:1}

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here