Why i can't input data to def from console? what's wrong in my codes?


#1

Hi, i wanted to do Parameters and Arguments lesson with some edit and make it to put data from console but it have this error ==>
Traceback (most recent call last):
File "python", line 6, in
File "python", line 2, in power
TypeError: unsupported operand type(s) for ** or pow(): 'unicode' and 'unicode'


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


#2

These are strings. Convert with int().


#3

thanks a lot :bow::ok_hand:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.