Created
March 29, 2016 18:58
-
-
Save pablovv72/212f82e1381a77aa3cf46640a4ce990a to your computer and use it in GitHub Desktop.
Pi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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