Lab 2

This is Lab 2. In this lab, I used the two variables “a” and “b”. I made it so that the user/programmer inputs a value for “a” and “b” then the program runs an operation to find the Sum,Difference,Product,Quotient, and the Remainder of the assigned values. This program also indicates whether the first value is greater than the second value and vice versa. It also determines if the values are the same. I enjoyed exploring python and seeing what its capabilities are. The program I worked on felt like I was making a graphing calculator.

Here is the code i used for the program:

# This is our first script
# Program to operate on two integers a and b

a_str=raw_input(‘Please Enter a Number: ‘)

b_str=raw_input(‘Please Enter Second Number: ‘)

a=int(a_str)

b=int(b_str)
#This is the processing stage
my_sum = a+b

my_difference=a-b

my_product=a*b

my_quotient=a/b

my_remainder=a%b

#This is the output stage

print (‘The sum of my numbers is: ‘,my_sum)

print (‘The difference of my numbers is: ‘,my_difference)

print (‘The product of my numbers is: ‘,my_product)

print (‘The quotient of my numbers is: ‘,my_quotient)

print (‘The remainder of my numbers is: ‘,my_remainder)

if a>b:
print(‘The first value is greater than the 2nd. ‘)

elif a<b:
print(‘The 2nd value is greater than the 1st. ‘)

else:
print(‘Both values are the same ‘)

And here are some screenshots of the results of the program and the code i used: