Skip to content

Instantly share code, notes, and snippets.

View wellmotta's full-sized avatar

wellmotta

  • Santa Barbara DOeste / SP - Brazil
View GitHub Profile
import pandas as pd
def periodo(linha):
horario = linha['hora completa']
if '06:00:00' < horario < '11:59:00': return 'Manha'
elif '12:00:00' < horario < '17:59:00': return 'Tarde'
elif '18:00:00' < horario < '23:59:00': return 'Noite'
elif '00:00:00' < horario < '05:59:00': return 'Madrugada'
return ''
import random
def gera_lista(qnt):
listas = []
numeros = random.sample(range(1, 100), 25)
# Sorteia 13 elementos da lista `numeros`
primeiros = random.sample(numeros, 13)
# Pega a diferença entre a lista `numeros` e a lista `primeiros`
# e define como novo valor da lista `numeros`
numeros = list(set(numeros).difference(set(primeiros)))
import random
from itertools import chain
numeros = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]
listas = []
def gera_lista(qnt):
nova_lista = []
# Sorteia os 13 primeiros elementos
primeiros = random.sample(numeros, 13)
# Pergunta: https://pt.stackoverflow.com/questions/300478/
n = int( input() )
colecao = [ list( map(int, input().split(',')) ) for _ in range(n) ]
print(colecao)
@wellmotta
wellmotta / Chat.php
Last active May 26, 2017 00:22
Chat example
<?php
class Chat
{
private $Rooms = [];
public function createRoom($Name)
{
$RoomID = md5($Name);
$this->Rooms[$RoomID] = new Room($Name);
}
@wellmotta
wellmotta / AgendaContatos.php
Created May 25, 2017 23:04
Example of contact schedule
<?php
class AgendaContatos
{
private $Nome = "";
private $Email = "";
private $Telefones = array();
private $Celulares = array();
public function getNome() { return $this->Nome; }
<?php
function ColocaEspacos($Titulo = null, $Valor = null)
{
$Qnt = 20;
$Espacos = "";
if ( $Titulo == null )
{
for ( $i = 0; $i < $Qnt; $i++ )
{