working with lists
Classwork:
Write a new program, ListClwk_YI.py with the work develop in class.
1. Create a list, aList of 100 integers from 1 through 100.
Some tricks you should know:
total = 0 for i in range( len( aList ) ): total += aList[i] print ("the sum of all items in the list is ", total) total = 0 for item in aList: total += item print ("the sum of all items in the list is ", total) print ("the sum of all items in the list is ", sum(aList))
2. Create an empty list and adds to the end of the list 100 random integers from 10 to 500
3. Print the list in 10 rows by 10 columns format. Make sure the columns are lined up.
4. Count the number of integers that are even and odd and displays the values with a message.