Lab 2

Lab Description:

This lab is about what we learned in class. We learned and tried out different statements. This lab uses Operators like +,-,* (addition, subtraction, multiplication, and etc..) this also uses chained conditions where it goes down the list to see which statement it should execute. Then in the end it should loop.

option = 1
while (option == 1):
option = input ("select and option: (1)Enter numbers (2)Exit")
print option
if (option == 1):
x = input ("Enter value x")
y = input ("Enter value y")
z = x+y
print "x+y =", z
z = x-y
print "x-y =", z
z = x*y
print "x*y =", z
z = x/y
print "x/y =", z
z = x%y
print "x%y =", z
if x < y:
print 'x is less than y'
elif x > y:
print 'x is greater than y'
print 'x and y are equal'


Leave a Reply

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