Skip to content

Instantly share code, notes, and snippets.

@pablovv72
Created March 29, 2016 18:58
Show Gist options
  • Save pablovv72/212f82e1381a77aa3cf46640a4ce990a to your computer and use it in GitHub Desktop.
Save pablovv72/212f82e1381a77aa3cf46640a4ce990a to your computer and use it in GitHub Desktop.
Pi.py
# coding: utf-8
import ui
import time
i, pi, ti = 1.0, 0.0, time.clock()
view = ui.load_view('Pi')
view.present('sheet')
while True:
pi = pi + 4 / i - 4 / (i + 2)
i += 4
if time.clock() - ti >= 1: # Muestra aproximación cada segundo.
view['label1'].text = str(pi)
ti = time.clock()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment