# A simple calculator
x=input("What do you want to do? \n 1) Add \n 2) Subtract \n 3) Multiply \n 4) Divide \n")
#This is a comment, note that single line comments start with a hash '#'
"""'x' is a variable. The 'input' statement accepts a number where as the 'raw_input' accepts a String. Note that multiline
comments start with a three quotes"""
if x==1:
a=input("Enter a number: ")
b=input("Enter another number: ")
c=a+b
print ("The sum of "+a+" and "+b+" is: "+(a+b))
elif x==2:
a=input("Enter a number: ")
b=input("Enter another number: ")
c=a-b
print ("The difference of "+a+" and "+b+" is: "+(a-b))
elif x==3:
a=input("Enter a number: ")
b=input("Enter another number: ")
c=a*b
print ("The product of "+a+" and "+b+" is: "+(a*b))
elif x==4:
a=input("Enter a number: ")
b=input("Enter another number: ")
c=a/b
print ("The quotient of "+a+" and "+b+" is: "+(a/b))
""" In Python, contrary to Java, you don't have to explicitly specify the data type of a variable, instead Python
implicitly determines the data type! Note that commenst spawning over many lines beging with three quotes """
raw_input("\nPress any character to quit the program.")
# Since we don't want the program to quit immediately after printing the output, we add a 'raw_input' statement
# Try removing the 'raw_input' statement at the last and see what happens.
The code I used above just doesn't work! It says it cannot concatenate String and Int objects! Is there a way to solve this?
Thanks