Public feed #724575

Untitled

public text v1 · immutable
Raw Edit
·published 2007-10-03 18:09 UTC
rendered paste body
from Tkinter import *

global e

def calc():
	i = int(str(e.get()))
	y = 1
	v = 0
	r = ((i*4) + 1)
	for y in range(r):
		y +=4
		v = v+((1/y) - (1/(y +2)))
	print v*4

window = Tk()
lbl = Label(window, text='How many iterations?')
lbl.pack(side=TOP)
e = Entry(name='text')
e.pack(expand = YES, fill = BOTH)
b = Button(window, text='Calculate', command=calc)
b.pack(side=BOTTOM)
window.mainloop()