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 random | |
def main(): | |
# Iniciando | |
acima = 0 | |
abaixo = 0 | |
certo = 0 | |
number = random.randint(1, 100) |
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 turtle | |
turtle.shape("turtle") | |
turtle.speed(speed=1) | |
MINIMUM_BRANCH_LENGTH = 5 | |
def build_tree(t, branch_length, shorten_by, angle): | |
if branch_length > MINIMUM_BRANCH_LENGTH: | |
t.forward(branch_length) | |
new_length = branch_length - shorten_by |
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 pygame | |
import random | |
# Tetris, na moralzinha ;) | |
colors = [ | |
(0, 0, 0), | |
(120, 37, 179), | |
(100, 179, 179), | |
(80, 34, 22), | |
(80, 134, 22), |
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
tc = float(input('Temperatura em Celsius: ')) | |
print ('Temperatura em Fahrenheit: %.2f' %(9*tc/5 + 32)) |
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 requests | |
api_key = "db495e6f05aacf29d13e7dae7e1c033e728e1" | |
# URL | |
url = "https://www.google.com" | |
# Name | |
api_url = f"https://cutt.ly/api/api.php?key={api_key}&short={url}" | |
# ou | |
# api_url = f"https://cutt.ly/api/api.php?key={api_key}&short={url}&name=some_unique_name" | |
# Request |
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 shuffle, randrange | |
def make_maze(w = 16, h = 8): | |
""" Cria um labirinto aleatório e o desenha na tela em ASCII Art | |
Parâmetros: | |
w - o número de colunas do labirinto (padrão: 16) | |
h - o número de linhas do labirinto (padrão: 8) | |
""" | |
# Matriz de células visitadas (0 = não visitada, 1 = visitada) |
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
# pong! | |
import pygame | |
BLACK = (0, 0, 0) | |
RED = (255, 0, 0) | |
GREEN = (0, 255, 0) | |
# Coordenadas p1, p2 and ball | |
x1 = 490 | |
y1 = 250 | |
x2 = 0 |
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 numpy as np | |
import pygame | |
import sys | |
import math | |
BLUE = (0,0,255) | |
BLACK = (0,0,0) | |
RED = (255,0,0) | |
YELLOW = (255,255,0) |
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
#Jogo da Velha! | |
theBoard = {'7': ' ' , '8': ' ' , '9': ' ' , | |
'4': ' ' , '5': ' ' , '6': ' ' , | |
'1': ' ' , '2': ' ' , '3': ' ' } | |
board_keys = [] | |
for key in theBoard: | |
board_keys.append(key) |
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 tkinter import * | |
import numpy as np | |
size_of_board = 600 | |
number_of_dots = 6 | |
symbol_size = (size_of_board / 3 - size_of_board / 8) / 2 | |
symbol_thickness = 50 | |
dot_color = '#7BC043' | |
player1_color = '#0492CF' | |
player1_color_light = '#67B0CF' |