LAB2 Python1

This program can be divided into main steps:

1st step: Take the input from the user with the string data type.

2nd step: Convert the data into integer.

3rd step: manipulate the data with basic math operations.

4th step: send the output to the screen by print statement.

Source code:

# Ask user for 1st number
numStr1 = input(‘Please enter the first integer number: ‘)

# convert to integer
intVar1 = int(numStr1)

# Ask user for 2st number
numStr2 = input(‘Please enter the second integer number: ‘)

# convert to integer
intVar2 = int(numStr2)

# Print the addition
print (‘The sum of’, intVar1, ‘and’, intVar2, ‘is:’, intVar1+intVar2 )

# Print the subtraction
print (‘The difference of’, intVar1, ‘and’, intVar2, ‘is:’, intVar1-intVar2 )

# Print the multiplication
print (‘The product of’, intVar1, ‘and’, intVar2, ‘is:’, intVar1*intVar2 )

# Print the division and remainder
print (‘The quotient of’, intVar1, ‘and’, intVar2, ‘is:’, intVar1//intVar2,
‘ with remainder:’, intVar1%intVar2)