Lab2

Assignment Notes:
To input the numbers it is necessary to use the raw_input function. The raw_input
function takes a string, a sequence of characters between quotes, as a prompt to print to the
user. It then waits until the user types a response, terminated by the user typing the Enter key.
A string, again as a sequence of characters, is returned.

Code:

“”” Created on tues Oct 16 2012
author: Johan Alvarez
1111 – 4300
CET New York City College of Technology
“””

inputStr1 = (raw_input) (‘please enter the first number: ‘)
inputInt1 = int(inputStr1)
inputStr2 = (raw_input) (‘please enter the second number: ‘)
inputInt2 = int(inputStr2)

print (‘the sum of’),inputInt1,(‘ and ‘),inputInt2,(‘ is: ‘),inputInt1 + inputInt2

print (‘the result of subtracting’),inputInt1,(‘ and ‘),inputInt2,(‘ is: ‘),inputInt1 – inputInt2

print (‘the product of’),inputInt1,(‘ and ‘),inputInt2,(‘ is: ‘),inputInt1 * inputInt2

print (‘the integer division of’),inputInt1,(‘ and ‘),inputInt2,(‘ is: ‘),inputInt1 / inputInt2,(‘ with remainder: ‘),inputInt1 % inputInt2

 

Display