Matthew
2013-03-25 10:57:58 UTC
#exponents.py
#Finds powers.
a=input("Type in a base number.")
b=input("Type in an exponent.")
print("Would you like to calculate", a "to the power of", b "? 1 is yes and 5 is no.")
answer=raw_input()
if(answer<2):
print a**b
if(answer>4):
print("OK! No powers for you! :P")
I am new to Python and when I try to run the program, it says that there is an invalid syntax at the brackets(Not in the actual code). I think it has to do with the variables. Also, I am on Python 2.
print("Would you like to calculate", a "to the power of["], b "? 1 is yes and 5 is no.")