As of this moment I have been switching back and forth between various iterations of my first foray into Python programming software, in any case part of my assignment calls for finding the count of even and odd numbers in a set of values that the user inputs, here is the code below:
smallest = 124301293123 largest = 0 location = 0 loc_largest = 0 loc_smallest = 0 value = '-1' while True: location = location + 1 num = input("enter number ") if num == "0": #check for end of input print "the largest is ", largest print "at location ", loc_largest print "the smallest is ", smallest print "at location ", loc_smallest print "the count of numbers is", len(num) li =  li.append(num(n)) print min(li) x = l1 list(num%2 == 0) for l in l1: if x>l: x=l print "Smallest is", x print (num*len(num)) / sum print "average is", average(num) print "The count of even numbers is", len(num%2 == 1) print len(num%2 == 0) print len(num%2 == 1) sys.exit(0) else: if num > largest: #found new largest largest = num loc_largest = location if num < smallest: #found new smallest smallest = num loc_smallest = location
Parts of the code are unworkable and represent attempts at guesswork and general tooling around to get the solution that I want. For finding the len and the len of even and odd I am at loss as the len returns only 1 and my attempt at finding the len of even numbers was mostly based around trying to use remainders as an indicator as to whether or not the input was even e.g print len(num%2 == 0). Any thoughts on the solution to my conundrum?