by Phantom Wolf on Wed Aug 03, 2011 12:06 pm
([msg=60491]see Re: Euler #9[/msg])
Reason7194 wrote:- Code: Select all
def triplit(a,b,c):
if a<b and b<c:
if (a^2)+(b^2) == (c^2):
return 1
return 0
print main()
It looks like you're trying to use ^ as an exponential operator, right? r-ID is right, that's not what ^ does (I believe it's the xor operator), his answer is also correct.
However, for future reference, the exponential operator is ** (two asterisks). There's also the pow function. Example
- Code: Select all
print 2 ** 3
print pow(2, 3)
"Well it isn't my fault. I shouldn't have been allowed to do something to crash it." "No, you shouldn't have been allowed to buy a computer in the first place"