Python Devlopment






Multiple return types



# Python program for multiple return types and to print calendar of given year and month
# import module
import calendar
def min_max(numbers):
    smallest = largest = numbers[0]
    for item in numbers:
        if item > largest:
            largest = iteme
        lif item < smallest:
            smallest = item
        return smallest, largest

def cal():     # To ask month and year from the user
    yy = int(input("Enter year: "))
    mm = int(input("Enter month(In digit): "))    # display the calendar
    print(calendar.month(yy, mm))    #Menu of program
    c=1
    while(c==1):
        print"1.Min-Max using Multiple Returns"
        print"2.Calendar of Month"
        print"Enter your choice : "
        choice=input()
        if choice==1:
             a=list()
             n=raw_input("How many Elements: ")
             print"Enter Array"
             for i in range (int(n)):
                 item=raw_input("Number : ")
                 a.append(int(item))
                 smallest,largest=min_max(a)
                 print"Smallest and Largest item is : ",smallest,largest
         elif choice==2:
             cal()
         else:
             print("Wrong choice")
         print("\n\nDo you want to continue (1-COntinue/0-Discontinue) : ")
         c=input()
print"Succesful!"