Homework: list processing

In this project you are to start by copying the following code into Spyder and fill in the indicated slots with the proper code. When you have it running and tested print out the source and output to turn in. Start on it now so if you have problems you  have time to get help.

# Place your name and project number here.
# Allthough nums is hard coded here assume it is
# not. IE you do not know the numbers or how many
# This means you will have to start by determining  
# the length of the list. Look up how to do this.
# use for i in nums: to traverse the list in
# each of the cases below.
 # To make sure your program is correct try it with  
# several different sequences with different numbers
# and different lengths. We will restrict all values
# to numbers less than 100! This is mainly for the
# last calculation for primeness.
nums =[1,5,3,6,4,8,6,12,31,15,7,18,9,21,14,37,16]
# first calculate and print out the average of
#the numbers in nums
 <write code here to do the above calculation>
#Calculate and print the largest and the smallest
# of nums   

 <write code here to do the above calculation> 

#A list is said to even abundant if there are more
#evens than odds, otherwise it is said to be odd
# abundant, Print out whether it is even or odd
#abundant.  

 <write code here to do the above calculation>
#calculate and print the number of times a value in
#the list is greater than the immediately previous
#value
   <write code here to do the above calculation>
#This last case is a little more challenging
# Print out the values in nums that are prime.   

<write code here to do the above calculation>

Comments are closed.