Lab 2

Lab Description: In this lab we were told to perform different operations using different formats and see the results and how the program functions it.

Lab Experience: During this lab I realized python could perform many operations and find/give exact values of such math problems.  However if you happen to misplace one or more commands in order u will be getting syntax errors.

Codes:

def RiOp(x=input(“Enter value for x: “),y=input(“Enter value for y: “)):
import sys
x = int(x)
y = int (y)
if x == 0 or y == 0:
sys.exit()
else:
print (x+y)
print (x-y)
print (x*y)
print (x/y)
print (x%y)
if x < y:
print (x,”<“,y)
if x > y:
print (x,”>”,y)
if x == y:
print (x,”==”,y)
RiOp(x=input(“Enter value for x: “),y=input(“Enter value for y: “))

RiOp()

 

 

Screenshots of Results:

lab 2 1

lab 2 2