Parametres and arguments


#1

my code doesn't seem to be working and I do not know why?


this is my code
def power  (37,4): 
result = base**exponent
print "%d to the power of %d is %d." % (base, exponent, result)

power (37,4)
and this is what it is saying in the console
 File "python", line 1
    def power  (37,4):
                 ^
SyntaxError: invalid syntax
and then the box that gives you a hint says
Oops, try again. Did you remember to put a comma between your parameters and arguments?


#2

Hi this part

def power  (37,4):

inside the () you should put the arguments base and exponent like that


#3

i have tried changing round the def power (37,4) but it comes up with the same problem


#4

can you post your new code?


#5

here is my new code
def power (37 , 4):
result = base**exponent
print "%d to the power of %d is %d." % (base, exponent, result)

power (37 , 4)


#6

that part

def power (37 , 4):

should be like that

def power (base, exponent):

#7

thanks it now doesn't have a problem with that and this is my new code
def power (
base,exponent):
result= base**exponent
print "%d to the power of %d is %d." % (base, exponent, result)

power (37 , 4)
but this is the error it is coming up with
Traceback (most recent call last):
File "python", line 4, in
NameError: name 'base' is not defined


#8

I just ran your code and it works, try to refrsh the page


#9

This is the code I used:

def power(base,exponent):  # Add your parameters here!
    result = base**exponent
    print "%d to the power of %d is %d." % (base, exponent, result)

power(37 , 4)  # Add your arguments here!