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

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 array2. Create a for loop that repeats 5 timesa. Inside the for loop, generate a random number and append itto the array3. 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_JohnMarcelDaisySamanthaNelsonDeborah0================Output:JohnMarcelDaisySamanthaNelsonDeborahHints:
• Create an array Names to hold the input names.• Use the Names.append(x) function to add a new name to theNames array. The input x to the append(x) function represents aname that should 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_1027231281================Output:8112232710Hints:
• Create an array Numbers to hold the input numbers.• Use a FOR loop with a counter that goes from 1 to 5 in orderto read in 5 numeric values. Use the append() function to addnumbers to the array.• Use another FOR loop to print the 5 numeric values inreverse order. The loop counter should be used as the index toaccess the values in the Numbers array. In order to print thenumbers in reverse order, the loop counter should start at 4 andgoes down to 0. This can be done by reversing the range of the FORloop as follows:o for c in reversed( range (5) ):
P4. (10 points)Write a Python function called string_times(msg, n) that takestwo input parameters:• String msg• Integer Number nAnd 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).o Inside the while loop, print the msg once, then increment jby 1.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 problem that includes:a. PACb. Algorithmc. Python CodeLab DeliverablesFor all problems, submit a screen shot of your code and yourobtained output.

Expert Answer


Answer to P1. (5 points)Write Python code for creating an empty array, then use a loop to generate 5 random values and insert them…