[ad_1]
Performance Assessment2-2 – Repetitive structures – For and While Loops
Task 1 – Pseudocode
Now we are going to write a program to put 100 random numbers in a list and sort them.
Let’s start with the pseudocode
Program SortRandomNumbers:
End.
Deliverables for Task 1
- Pseudocode for sort numbers program
Task 2 – Sort number program
Now let’s put together the program. Open the Python IDLE program and create a new program called <Your Name>_PA22 in this Window
Import a module called random
In your program create a list named list[].
Put in a loop that appends 100 random numbers to a list using the function
for i in range(100):
list.append(random.randint(1,100))
print the list of numbers in its original order
Then we’ll sort the list
list.sort()
print out the sorted list of numbers
Modify the program to have 1000 numbers on the list.
Take a screenshot of your completed program and another of your output.
Deliverables for Task 2
- Screenshot of your completed program
- Screenshot of the output from your program
[ad_2]