Skip to content

Categories:

Lab 2

In this lab i am simply telling python to ask the user for two integers. once the user inputs the first number, python will immediately ask the user to input another number. once both numbers are recorded, python will then add the first number by the second. then python will subtract the second number by the first. after subtracting then, python will then multiply the first number by the second. lastly, python will divide the first number by the second number.

source code:

print(‘Enter first of two numbers’)
num1 = input()
print(‘Enter second of two numbers’)
num2 = input()
#how to tell if input number is two digits?
print(int(num1) + int(num2))
#Second line: the result of subtracting the second number from the first
print(‘subtracting the second number from the first gives us…’)
print(int(num1)-int(num2))
#Third line: the product of the first and the second number
print(‘multiplying these two numbers gives us…’)
print(int(num1)*int(num2))
#Fourth line: the integer division of the first number by the second number,
#followed by the remainder from dividing the first number by the second number
print(‘dividing the first number by the second gives us…’)
print(int(num1)/int(num2))