Basic Lists 2¶
Create an empty List. Append ten random numbers from 1
to 100
. Then display the contents of the list on the screen. You must use a loop.
And, like last time, you must use the len()
function and not a literal number (like 10
) in loop range
.
Name the file list2.py
Slot 0 contains a 45
Slot 1 contains a 87
Slot 2 contains a 39
Slot 3 contains a 32
Slot 4 contains a 93
Slot 5 contains a 86
Slot 6 contains a 12
Slot 7 contains a 44
Slot 8 contains a 75
Slot 9 contains a 50
©2021 Daniel Gallo
This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Adapted for Python from Graham Mitchell’s Programming By Doing