Task 1 Task 2 Task 3
Task 1 Task 2 Task 3
king

Task 1

Code the algorithm on the home page of this unit. Test it until you are satisfied that it works properly.

king

Task 2

A teacher stores student names in an array as follows:

 "Alex""Janice""Nicki""Jay""Maya""Bob"
index012345

She needs a computer program that will select 1 random name.

Write this program. Think logically! This is an easy question to over-complicate!

Task 3

A computer program generates 1000 random numbers between 0 and 1000 and stores them in an array:

arr = [ ]

for i in range(1000):

rand = random.randint(0,1000)

arr.append(rand)

print(arr)

It then counts how many of the numbers are odd and how many are even and displays the result.

Write this program.

Note: see how useful Python's append function is when working with arrays!.