pudb/debug_me.py

41 lines
713 B
Python
Raw Normal View History

2009-06-09 07:37:13 +04:00
def simple_func(x):
x += 1
s = range(20)
z = None
w = ()
y = dict((i, i**2) for i in s)
k = set(range(5, 99))
try:
x.invalid
except AttributeError:
pass
#import sys
#sys.exit(1)
2009-06-09 07:37:13 +04:00
return 2*x
2009-06-08 22:50:27 +04:00
def fermat(n):
"""Returns triplets of the form x^n + y^n = z^n.
Warning! Untested with n > 2.
"""
from itertools import count
2009-07-26 01:56:29 +04:00
for x in range(100):
2009-06-08 22:50:27 +04:00
for y in range(1, x+1):
for z in range(1, x**n+y**n + 1):
2009-06-09 10:44:13 +04:00
#from pudb import set_trace; set_trace()
2009-06-08 22:50:27 +04:00
if x**n + y**n == z**n:
yield x, y, z
2009-06-09 07:37:13 +04:00
print "SF", simple_func(10)
2009-06-08 22:50:27 +04:00
for i in fermat(2):
print i
2009-07-26 01:56:29 +04:00
print "FINISHED"