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 factorial, radians, isclose, sin | |
def seno(x, n=7): | |
# Se o ângulo for em graus, converte para radianos | |
if x > 1: | |
x = radians(x) | |
def termo_geral(x, i): | |
return ((-1)**i / factorial(2*i+1)) * (x**(2*i+1)) |
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
{ | |
"has_more": true, | |
"items": [ | |
{ | |
"display_name": "Maniero", | |
"location": "Rio Claro - SP - Brasil", | |
"reputation": 288138 | |
}, | |
{ | |
"display_name": "Sergio", |
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
__author__ = 'Anderson Carlos Woss' | |
def hello(): | |
f'Autor: {__author__}' | |
print('Hello') | |
print(hello.__doc__) # None |
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
def hello(): | |
'Exibe uma saudação' | |
print('Hello') | |
print(hello.__doc__) |
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 | |
dimensions = input('Dimensões da matriz NxM: ').split() | |
N, M = [int(value) for value in dimensions] | |
matrix = [] | |
for i in range(N): | |
row = input(f'Linha {i+1}: ').split() |
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 | |
dimensions = input('Dimensões da matriz NxM: ').split() | |
N, M = [int(value) for value in dimensions] | |
matrix = [] | |
for i in range(N): | |
row = input(f'Linha {i+1}: ').split() |
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
{ | |
"colors": [ | |
{ | |
"color": "black", | |
"category": "hue", | |
"type": "primary", | |
"code": { | |
"rgba": [255,255,255,1], | |
"hex": "#000" | |
} |
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 sched, time, threading, sys | |
print('Para quando deseja configurar o alarme?') | |
year = int(input('Ano? ')) | |
month = int(input('Mês? ')) | |
day = int(input('Dia? ')) | |
hour = int(input('Hora? ')) | |
minute = int(input('Minutos? ')) | |
second = int(input('Segundos? ')) |
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
data = ['Joao', '83889023', 'Maria', '81944356', 'Marcos', '32258899', 'Ana', '88235423', 'George', '1254345', 'Rafaela', '8899345671', 'Pedro', '83223345', 'Aline', '842234565', 'Carlos', '83554463', 'Julia', '13565446', 'Murilo', '23543646', 'Mayra', '233253425', 'Italo', '842142543', 'Rita', '3253464457', 'Aldo', '77443456', 'Raquel', '8384423553', 'Henrique', '88342235', 'Joyce', '987676342', 'Daniel', '3253456346', 'Livia', '325346634', 'Pablo', '87461723', 'Carla', '87351236'] | |
def pairwise(iterable): | |
it = iter(iterable) | |
return zip(it, it) | |
name_map = {number: name for name, number in pairwise(data)} | |
print(name_map) |
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
palavra1 = {'palavra': 'sim', 'positivo': 0} | |
palavra2 = {'palavra': 'não', 'positivo': 0} | |
palavras = [palavra1, palavra2] | |
resultado1 = filter(lambda termo: termo['palavra'] == 'sim', palavras) | |
resultado2 = [termo for termo in palavras if termo['palavra'] == 'sim'] | |
resultado3 = (termo for termo in palavras if termo['palavra'] == 'sim') | |
print('Utilizando filter:', list(resultado1)) | |
print('Utilizando list comprehension:', resultado2) |