We have seen that a list is an ordered collection of data items.
We can initialize a list by writing:
myList = [2, 5, 7, 3]
This list contains the integer values, 2, 5, 7 and 3 in that order. We can
initialize a list as empty by writing:
myList = []
I need to do this before using the list in question.
If I want to use the values on the list, I can use a counting loop:
numValues = int(input("How many values\t?"))
myList = []
for i in range(numValues):
x = int(input("What is the value\t?"))
myList.append(x)
print(myList)
After obtaining the number of values that I will place on the list, I initialize it as an empty list. Within the loop, I obtain each of the values one iteration at a time and then use the append method to add it to the end of the list.
In this assign, write a program that read in the number of values that will be on the list. Read in that number of values and in a separate loop add them up and print the average. Include a flowchart and pseudocode.
`