Lab 2


For lab 2 we had to make a control flow. Most of this code works except for the last part for option 6. I¬†couldn’t figure it out.


#Mabel Fermin
#Lab 2 – Control Flow
#Date: 2/26/13
#Session: 9310

x = int(input (‘enter the first number:’))
y = int(input (‘enter the second number: ‘))
print (‘enter 1 to add the numbers’)
print (‘enter 2 to substract the numbers’)
print (‘enter 3 to multiply the numbers’)
print (‘enter 4 to divide the numbers’)
print (‘enter 5 to find the remainder of x%y’)
print (‘enter 6 for x<=y’)
z = int(input(‘enter your selection:’))
if z==1:
result = x+y
print (‘the sum of ‘,x,’ and ‘,y,’ is: ‘,result)
elif z==2:
result = x-y
print (‘the difference of ‘,x,’ and ‘,y,’ is: ‘,result)
elif z==3:
result= x*y
print (‘the product of ‘,x,’ and ‘,y,’ is: ‘,result)
elif z==4:
result= x/y
print(‘the quotient of ‘,x,’ and ‘,y,’ is: ‘,result)
elif z==5:
result= x%y
print(‘the remainder of ‘,x,’ and ‘,y,’ is: ‘,result)
if x<=y:
if x = y then (‘the numbers are equals’,result)
elif x < y then (‘,x,’ is less than ‘,y,’,result)
else x > y then (‘,x,’ is greater than ‘,y,’ result)