#this program demonstrates Chapter 6.4 material #in this program user will first enter 1 or 2 to choose between processing even numbers #and odd numbers #then, user enters the size of the input and the appropriate functions are called #for even numbers - we are using functions from file even.py and for odd numbers we are using #functions from file odd.py #PAY ATTENTION: the names of the functions ARE THE SAME but since they belonged to different #libraries, and stored in different files there is no confusion #To call the function from specific module(file), first write the name of the file #then the name of the function after separation dot character import even import odd def main(): print("enter choice: 1 for evens 2 for odds ") choice = int(input(" ")) if (choice == 1): size = int(input("enter size of the input ")) if(size > 0): cEven, sEven = even.sumCount(size) if(cEven > 0): ave = even.average(cEven, sEven) print("there are ", cEven, "evens") print("their sum is ", sEven) print("their average is ", ave) else: print("no even numbers in the input ") else: print("size of the input is invalid ") elif(choice == 2): size = int(input("enter size of the input ")) if(size > 0): cOdd, sOdd = odd.sumCount(size) if(cOdd > 0): ave = odd.average(cOdd, sOdd) print("there are ", cOdd, "odds") print("their sum is ", sOdd) print("their average is ", ave) else: print("no odd numbers in the input ") else: print("size of the input is invalid ") else: print("Invalid choice ") main()