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
amigos = {} | |
lines = open("picnic.txt").readlines() | |
for line in lines: | |
line = line.split() | |
amigo = line[0] | |
amigos[amigo] = {} | |
i = 1 | |
while i < len(line): |
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 statistics | |
notas = {} | |
lines = open("notas.txt", encoding = 'utf-8').readlines() | |
for line in lines: | |
proc = line.split() | |
notas[proc[0]] = statistics.mean([int(proc[1]), int(proc[2]), int(proc[3]), int(proc[4])]) |
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
treasure_numb = 0 # Start tresures on 0 | |
info = input() | |
info_list = info.split(" ") | |
numb_chests = int(info_list[0]) | |
init_pos = int(info_list[1]) | |
instruction_numb = int(info_list[2]) | |
locations = str(input()) |
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
a = [[5,9,19,0,3,-45,7,3,-20], | |
[-19,2,3,-8,3.5,18.9, 24,3.12,42,9], | |
[51,9.7,-9,-20,38,-4.5,17,103,-2.8], | |
[-9,322,33,18,387.5,9018.9,3,0, 2214], | |
[25,900,-19,10,31,-435,75,34,-240], | |
[-2.19,2,3,-8,3.5,18.9, 28,32,2]] | |
import numpy as np | |
def median(lista: list): |
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
a = [5,9,19,0,3,-45,7,3,-20] # Conjunto de dados aribrários | |
nova_lista = [] | |
def ordernar_lista(lista: list): | |
while lista: | |
minimo = lista[0] | |
for i in lista: | |
if minimo > i: | |
minimo = i | |
nova_lista.append(minimo) |
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
a = [5,9,19,0,3,-45,7,3,-20] | |
b = [-19,2,3,-8,3.5,18.9, 24] | |
def soma(lista: list): | |
soma = 0 | |
for i in lista: | |
soma += 1 | |
return soma | |
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
a = [5,9,19,0,3,-45,7,3,-20] | |
b = [-19,2,3,-8,3.5,18.9, 24] | |
def pos_minimo(lista: list): | |
minimo = lista[0] | |
for i in lista: | |
if minimo > i: | |
minimo = i | |
return lista.index(minimo) |
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
a = [5,9,19,0,3,-45,7,3,-20] | |
b = [-19,2,3,-8,3.5,18.9, 24] | |
def media(lista: list): | |
soma = 0 | |
for i in lista: | |
soma += i | |
media = round(soma / len(lista), 1) | |
return media |
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
a = [5,9,19,0,3,-45,7,3,-20] | |
b = [-19,2,3,-8,3.5,18.9, 24] | |
def maximo(lista: list): | |
maximo = lista[0] | |
for i in lista: | |
if maximo < i: | |
maximo = i | |
return maximo |
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
# Interactive @ http://www.codeskulptor.org/#user46_IEOQH6HNJcnPhI2_1.py | |
# Implementation of classic arcade game Pong | |
import simplegui | |
import random | |
# initialize globals - pos and vel encode vertical info for paddles | |
WIDTH = 600 | |
HEIGHT = 400 | |
BALL_RADIUS = 20 |