(Solved) : P1 5 Points Write Python Code Creating Empty Array Use Loop Generate 5 Random Values Inser Q41391194 . . .

P1. (5 points)

Write Python code for creating an empty array, then use a loopto generate 5 random values and insert them into the array, andfinally use another loop to read the values in the array and printthem out. The steps for your code are:

1. Create empty array
2. Create a for loop that repeats 5 times
1. Inside the for loop, generate a random number and append it tothe array
3. Create another for loop that prints the elements of thearray.

P2. (10 points)

Write a Python program that keeps reading in names from theuser, until the user enters 0. Once the user enters 0, you shouldprint out all the information that was entered by the user. Usethis case to test your program:

• Input:
John
Marcel
Daisy
Samantha
Nelson
Deborah
0
================
Output:
John
Marcel

Daisy
Samantha
Nelson
Deborah

Hints:

• Create an array Names to hold the input names.
• Use the Names.append(x) function to add a new name to the Namesarray. The input x to the append(x) function represents a name thatshould be added to the Names array.
• Once the user enters 0, stop reading in data, and startprinting out all the data from the Names array in the same orderthat they were entered.

P3. (10 points)

Write a Python program that reads in 5 numeric values, storesthem in an array, and then prints them in the reverse order thatthey were entered. Use this case to test your program:

• Input:

10

27

23

12

81

================
Output:
81

12

23

27

10

Hints:

• Create an array Numbers to hold the input numbers.
• Use a FOR loop with a counter that goes from 1 to 5 in order toread in 5 numeric values. Use the append() function to add numbersto the array.
• Use another FOR loop to print the 5 numeric values in reverseorder. The loop counter should be used as the index to access thevalues in the Numbers array. In order to print the numbers inreverse order, the loop counter should start at 4 and goes down to0. This can be done by reversing the range of the FOR loop asfollows:
• for c in reversed( range (5) ):

P4. (10 points)

Write a Python function called string_times(msg,n) that takes two input parameters:

• String  msg
• Integer Number n

And it prints out the msg as many times as n. Here are twoexamples for how the function should work:

• The function call string_times(‘Hi’,2) should print out’HiHi’
• The function call string_times(‘Hello’,3) should print out’HelloHelloHello’

You MUST use a while loop in your solution.

Hints:

• Create a counter j and set it equal to 0.
• Then create a while loop with the condition ( j < n).
• Inside the while loop, print the msg once, then increment j by1.

P5. (25 points)

John has a weather station in his house. He has been keepingtrack of the fastest wind speed for each day for two weeks. Hewould like to know the average wind speed over the two weeks, thedays on which the highest wind speed and the lowest wind speed wererecorded, and the difference between the highest wind speedrecorded and each day’s average wind speed.

Develop a solution for this problemthat includes:

1. PAC
2. Algorithm
3. Python Code

Lab Deliverables
For all problems, submit a screen shot of your code and yourobtained output.