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
nome = "World" | |
print(f"Hello {nome}!!") |
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
from typing import Tuple, Callable, Any, List, Union | |
ST = Tuple[int, str] | |
AnyParser = Union["Parser", str] | |
class Parser: | |
""" | |
Objeto responsável por ler um padrão de texto com uma chamada ao método | |
Parser.parse(). |
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
from math import cos, sin, radians | |
import matplotlib.pyplot as plt | |
X = 0 | |
Y = 0 | |
orientacao = 0 | |
desenhando = True | |
Xs = [[X]] | |
Ys = [[Y]] |
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
lst = [1, 42, 2, 10, 42, 11, 111, 42] | |
value = 42 | |
def all_indexes(lst, value): | |
idx = 0 | |
positions = [] | |
go = True | |
while go: | |
try: |
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
from time import time | |
from random import shuffle, randint | |
def ordenada(lst): | |
if len(lst) <= 1: | |
return True | |
x, *ys = lst | |
for y in ys: | |
if y < x: |
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
from math import cos, sin, radians | |
import matplotlib.pyplot as plt | |
X = 0 | |
Y = 0 | |
orientacao = 0 | |
desenhando = True | |
Xs = [[X]] | |
Ys = [[Y]] |
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
from random import choice | |
""" | |
intro : PLANETA em SIGNO <apontamento> | |
apontamento : VERBO_APTO sorte. | |
sorte : você terá SORTE AREA_DA_VIDA | |
| <sorte>, mas <sorte> | |
| <sorte> e também <sorte> | |
continuacao : "Cuidado com novas amizades, pois Marte e Mercúrio opostos sinalizam conflitos para o signo de Cancer." | |
""" |
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
import pyxel | |
from random import randint | |
# Declara variáveis globais | |
# Posição e velocidade | |
x = 20 | |
y = 40 | |
vy = -20 |
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
import pyxel | |
# Constantes | |
RAIO = 2 | |
ALTURA = 12 # altura de cada pá | |
LARGURA = 2 # largura de cada pá | |
P1_X = 3 | |
P2_X = 120 - 3 | |
FPS = 30 | |
dt = 1 / FPS |
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
# DICA: Lembre-se de criar um arquivo leaderboard.txt, | |
# caso ele não exista! | |
# Lê arquivo com recordes | |
with open("leaderboard.txt", "r") as arquivo: | |
recordes = [] | |
for linha in arquivo: | |
nome, _sep, valor = linha.rpartition(':') | |
recordes.append((nome, int(valor))) |