lab2
Description: This python code is a simple script. The script will ask the user to select 1 or 0 as options, 1 will run the if statement that will ask to give a input for x and y. if 0 is selected then the program exit.
source:
def option(t):
return
while option!=0:
option=int(input(“Enter 1 to use operation or 0 to exit. ” ))
if option==1:
x=int(input(‘enter a value for x ‘))
y=int(input(‘enter a value for y ‘))
s=x+y
print(“x+y=”, s)
n=x-y
print(“x-y=”, n)
m=x*y
print(“x*y=”, m)
d=x/y
print(“x/y=”, d)
k=x%y
print(“x%y=”, k)
print(“x>y: “, x>y)
print(“x=y: “, x==y)
print(“x<y: “, x<y)
Leave a Reply