Exercises
Exercise 1 – Create a Python function that generates random numbers from 1 to 20 and appends them to a List. The function will prompt the user for the list’s length, after which it will generate random integers ranging from 1 to 20 and append them to it. Make sure that the main program will print out the list.
To test your program.
The program input is as follows: >Enter number of elements: 3
Program expected output (hypothetical): >Randomized list is: ‘, [17, 4, 9]

Exercise 2 – Create a Python program to write the following list to a file called “ex2file.txt”:
[“python”, “is”, “awesome”]. Every element in the list will be saved in a separate line in the TXT file.

What to submit
Create a folder called “Lab_8.”
You must submit the source code for all exercises above. The source code files will be saved in the “Lab_8” folder that you created on your hard drive.
Name each source code file as follows: exercise<exercise_number>.py
Zip your folder “Lab_8” as a SINGLE zip file. The zip file should be named:
“lab8_S22.zip.”Any other file format will be rejected, and you will get Zero for this portion of your lab work.
It’s your responsibility that the zipped file of your submitted work is not empty or damaged.


    Make your order right away

    Confidentiality and privacy guaranteed

    satisfaction guaranteed