My teacher requests me to make a calculator that can calculate a 15% tip on a submitted price. I followed an online tutorial for this python application. I made a simple addition, subtraction, multiplication, and division calculator for practice before I make what my teacher requires. In the YouTube video I followed the python application ran on his computer. I get a a "Invalid Syntax" error in the Python Shell. I'm using Python 3.3.0. Thank you.
print "Hello"
def calc():x = int (raw_input("Input first integer: "))y = (raw_input("Input second integer: "))type = str.lower(raw_input("(A)dd, (S)ubstract, (M)ultiply, (D)ivide"))if type != "a" and type != "s" and type != "m" and type != "d":print ("Sorry, the command you entered is not calid.")calc():else:if type =="a":print ("The result is '" + str(x+y) + "'")elif type == "s":print ("The result is '" + str(x-y) + "'")elif type =="m":print ("The result is '" + str(x*y) + "'")elif type == "d":print ("The result is '" + str(float(x)/float(y) + "'")if str.lower (raw_input ("Would you like to perform another calculation?") == "y"):calc();else:exit([0])
calc();