This file contains hidden or 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
from random import seed, randrange | |
def code_random(text): # El texto ha de ser letras de A-Z (sin la Ñ) | |
# o espacios. | |
if len(text) % 4 > 0: | |
text += ' ' * (4 - len(text) % 4) # Añade espacios al final si es | |
# necesario. | |
seq = [] | |
tokens = [text[i:i+4] for i in range(0, len(text), 4)] # Divide el texto |
This file contains hidden or 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
# John Horton Conway Tribute 1937 - 2020 | |
try: | |
from console import clear # Define "clear" para iOS | |
except: | |
import os | |
if os.name == 'posix': | |
def clear(): # Unix, Linux, Mac o | |
os.system('clear') | |
else: |
This file contains hidden or 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
from time import * | |
i = 1 | |
pi = 0 | |
ti = time() | |
while True: | |
pi = pi + 4 / i - 4 / (i + 2) # método 1 | |
i += 4 | |
if time() - ti >= 5: |
This file contains hidden or 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
[ | |
{ | |
"nodes" : [ | |
{ | |
"nodes" : [ | |
], | |
"frame" : "{{64, 6}, {177, 32}}", | |
"class" : "Label", | |
"attributes" : { |
This file contains hidden or 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 clipboard | |
import console | |
import speech | |
def hablar(sender): | |
speech.say(v['textview1'].text) |
This file contains hidden or 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
import ui | |
import location | |
import time | |
import motion | |
from math import * | |
cardinales = ( | |
'N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', | |
'S', 'SSO', 'SO', 'OSO', 'O', 'ONO', 'NO', 'NNO' | |
) |
This file contains hidden or 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
[ | |
{ | |
"nodes" : [ | |
{ | |
"nodes" : [ | |
], | |
"frame" : "{{0, 0}, {375, 563}}", | |
"class" : "View", | |
"attributes" : { |
This file contains hidden or 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
'''Hallar un número acabado en 2 que cumpla la condición de que si se desplaza | |
el 2 a la posición inicial el número resultante es el doble del inicial.''' | |
n = 42 | |
exp = 2 | |
while 2 * 10 ** (exp - 2) + n // 10 != n * 2: | |
n = (n * 20 + 2) - (n * 20 + 2) // 10 ** exp * 10 ** exp | |
exp += 1 | |
print(n) |
This file contains hidden or 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
# Diseñe un algoritmo que calcule cuantos lotes de X mts. salen de X hectareas | |
while True: | |
metros_cuadrados = int(input('Número de hectareas: ')) * 10000 | |
if metros_cuadrados == 0: | |
break | |
lote = int(input('Metros cuadrados por lote: ')) | |
print(f'salen {int(metros_cuadrados / lote)} lotes.') |
This file contains hidden or 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
# Dibuja aleatoriamente polígonos con efecto caleidoscópico. | |
import turtle | |
from random import * | |
# Configuramos la pizarra para la tortuga. | |
t = turtle | |
clon = t.clone() |
NewerOlder