Lab 2: Creating a short program with python

In this lab I have written a short program that gets input from the user and does some basic mathematical operations and displays the results. Afterward is tells the user if x is greater than, less than or equal to y.

 


option = 1
while option == 1:
    option = input ("Menu : (1) Enter Numbers (2) Exit")
    #print option
    if option == 1: 
	    x = input ("Enter x ")
	    y = input ("Enter y ")
	    a = x+y
	    b = x-y
	    c = x*y
	    d = x/y
	    e = x%y
	    print a
	    print b
	    print c
	    print d
	    print e
    if x  y:
	    print ("x is greater than y")
    else :
	    print ("x is equal to y")

Screenshot 2013-10-05 at 19.52.15

Leave a Reply

Your email address will not be published. Required fields are marked *