diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/Python - Gustavo Guanabara.iml b/.idea/Python - Gustavo Guanabara.iml new file mode 100644 index 0000000..c444878 --- /dev/null +++ b/.idea/Python - Gustavo Guanabara.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..a2e120d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..897471e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/anagrama.py b/anagrama.py new file mode 100644 index 0000000..cccd662 --- /dev/null +++ b/anagrama.py @@ -0,0 +1,11 @@ +def perm(s, i=0): + if i == len(s) - 1: + print(s) + else: + for j in range(i, len(s)): + t = s + s = s[j] + s[:j] + s[(j + 1):] + perm(s, i + 1) + s = t +perm('AB') + diff --git a/apostila/08-Listas.pdf b/apostila/08-Listas.pdf new file mode 100644 index 0000000..b36fdc0 Binary files /dev/null and b/apostila/08-Listas.pdf differ diff --git a/configuracao_cores.PNG b/configuracao_cores.PNG new file mode 100644 index 0000000..0e86c45 Binary files /dev/null and b/configuracao_cores.PNG differ diff --git a/exerc001.py b/exerc001.py new file mode 100644 index 0000000..eecc33c --- /dev/null +++ b/exerc001.py @@ -0,0 +1 @@ +print("Olá Mundo") diff --git a/exerc002.py b/exerc002.py new file mode 100644 index 0000000..8d2b4f7 --- /dev/null +++ b/exerc002.py @@ -0,0 +1,3 @@ +n=input("Qual o seu nome:") +print("Seja bem vindo", n,"ao sistema") +print("Seja bem vindo {} ao sistema".format(n)) \ No newline at end of file diff --git a/exerc003.py b/exerc003.py new file mode 100644 index 0000000..d83059f --- /dev/null +++ b/exerc003.py @@ -0,0 +1,16 @@ +n1= int(input('Digite um número: ')) +n2=int(input('Digite mais um número: ')) +s= n1+n2 +print("[PRINT RAIZ] A soma é: ",s) + +print("[PRINT NUTELLA] A soma é: {}".format(s)) + +print("O tipo de dado da variavel S é: ",type(s)) + +#comentário +print("A soma entre",n1,"e",n2,"é=",s) +#versão do python 3 +print("A soma entre {} e {} é={} ".format(n1,n2,s)) + +print("############") +#print(s.isnumeric()) \ No newline at end of file diff --git a/exerc004.py b/exerc004.py new file mode 100644 index 0000000..d8d02b1 --- /dev/null +++ b/exerc004.py @@ -0,0 +1,12 @@ +n=input('Digite aqui:') +print("Voce digitou {}".format(n)) +print('###') +print(type(n)) +print(n.isalnum()) +print(n.isalpha()) +print(n.isdecimal()) +print(n.islower()) +print(n.isupper()) +print(n.isprintable()) +print(n.isalnum()) +print(n.istitle()) \ No newline at end of file diff --git a/exerc005.py b/exerc005.py new file mode 100644 index 0000000..564f43c --- /dev/null +++ b/exerc005.py @@ -0,0 +1,32 @@ +n1= int(input('Digite um número: ')) +n2=int(input('Digite mais um número: ')) + +print("A soma entre {} e {} é={} ".format(n1,n2,n1+n2)) +print("############") +print("A subtração entre {} e {} é={} ".format(n1,n2,n1-n2)) +print("############") +print("A multiplicação entre {} e {} é={} ".format(n1,n2,n1*n2)) +print("############") +print("A divisão entre {} e {} é={:.3f} ".format(n1,n2,n1/n2)) +print("############") +print("A potencia de {} elevado {} é={} ".format(n1,n2,n1**n2)) +print("############") +print("A potencia com POW de {} elevado {} é={} ".format(n2,n1,pow(n2,n1))) +print("############") +print("A divisão inteira de {} e {} é={} ".format(n1,n2,n1//n2)) +print("############") +print("#"*10) +nome= str(input('Digite seu nome: ')) +print("Prazer em te conhecer {}!".format(nome)) +print("#"*10) +print("[ESCREVE COM 20 ESPACO]Prazer em te conhecer {:20}!".format(nome)) +print("#"*10) +print("[ALINHADO A DIREITA 20 ESPACO]Prazer em te conhecer {:>20}!".format(nome)) +print("#"*10) +print("[ALINHADO A ESQUERDA 20 ESPACO]Prazer em te conhecer {:<20}!".format(nome)) +print("#"*10) +print("[CENTRALIZADO]Prazer em te conhecer {:^20}!".format(nome)) +print("#"*10) +print("[CENTRALIZADO COM UM SIMBOLO]Prazer em te conhecer {:=^20}!".format(nome)) +print("Não vou deixar quebrar a linha.", end=' ') +print("o barra n deixa quebrar. OLha aqui prazer {}\n seu lindo do \n universo.".format(nome), end=' ') diff --git a/exerc006.py b/exerc006.py new file mode 100644 index 0000000..40de0d9 --- /dev/null +++ b/exerc006.py @@ -0,0 +1,4 @@ +print('Programa Leia um NÚMERO e exiba seu sucessor e antecessor') +n1 = int(input('Digite um número:')) +print('¨¨¨'*20) +print('Você informou o número {}\nO número sucessor é {}\nO número antecessor é {}'.format(n1,n1+1,n1-1), end=' ') \ No newline at end of file diff --git a/exerc007.py b/exerc007.py new file mode 100644 index 0000000..9b79c31 --- /dev/null +++ b/exerc007.py @@ -0,0 +1,7 @@ +print('Receba um número e exiba o seu dobro, triplo e raiz quadrada') +n1=int(input('Informe um número:')) +print('¨¨¨'*20) +print('O dobro de {} é:{}'.format(n1,n1*2)) +print('O triplo de {} é:{}'.format(n1,n1*3)) +print('[POW] A raiz quadrada de {} é:{}'.format(n1,pow(n1,1/2))) +print('A raiz quadrada de {} é:{:.2f}'.format(n1,n1**(1/2))) \ No newline at end of file diff --git a/exerc008.py b/exerc008.py new file mode 100644 index 0000000..10e4bd4 --- /dev/null +++ b/exerc008.py @@ -0,0 +1,6 @@ +print('Receba 2 notas do aluno e calcule a média') +n1=float(input('Informe a 1ª nota:')) +n2=float(input('Informe a 2ª nota:')) + +m= (n1+n2)/2 +print('A média do aluno é {:.1f}'.format(m)) \ No newline at end of file diff --git a/exerc009.py b/exerc009.py new file mode 100644 index 0000000..7eb7224 --- /dev/null +++ b/exerc009.py @@ -0,0 +1,4 @@ +print('Converter Metros para centímetros e milímetros') +m=float(input('Informe a quantiade de metros:')) +print('A medida em metros de {} equivale a {} centímetros'.format(m,m*100)) +print('A medida em metros de {} equivale a {} milímetros'.format(m,m*1000)) diff --git a/exerc010.py b/exerc010.py new file mode 100644 index 0000000..e070c6c --- /dev/null +++ b/exerc010.py @@ -0,0 +1,26 @@ +print('Tabuada') +n1=int(input('Informe um número:')) +print('¨¨¨'*20) +c=1 +print('{} X {:2} = {}'.format(n1,c,n1*c)) +c=c+1 +print('{} X {:2} = {}'.format(n1,c,n1*c)) +c=c+1 +print('{} X {:2} = {}'.format(n1,c,n1*c)) +c=c+1 +print('{} X {:2} = {}'.format(n1,c,n1*c)) +c=c+1 +print('{} X {:2} = {}'.format(n1,c,n1*c)) +c=c+1 +print('{} X {:2} = {}'.format(n1,c,n1*c)) +c=c+1 +print('{} X {:2} = {}'.format(n1,c,n1*c)) +c=c+1 +print('{} X {:2} = {}'.format(n1,c,n1*c)) +c=c+1 +print('{} X {:2} = {}'.format(n1,c,n1*c)) +c=c+1 +print('{} X {:2} = {}'.format(n1,c,n1*c)) +c=1 +print('Pronto, Tabuada do {} na tela'.format(n1)) +print('-'*50) diff --git a/exerc011.py b/exerc011.py new file mode 100644 index 0000000..2ab7801 --- /dev/null +++ b/exerc011.py @@ -0,0 +1,6 @@ +print('Quantos Dólares vc pode comprar') +r = float(input('Informe quantos reais você tem na carteira R$:')) +d = 5.73 +print('A cotação do dólar atual é R${}\n'.format(d)) +print('Você pode comprar US${} doláres com esses {} reais que você tem'.format(r//d,r)) +print('Você pode comprar US${:.2f} doláres com esses {} reais que você tem'.format(r/d,r)) \ No newline at end of file diff --git a/exerc012.py b/exerc012.py new file mode 100644 index 0000000..ba3cd53 --- /dev/null +++ b/exerc012.py @@ -0,0 +1,6 @@ +print('PINTANDO MINHA PAREDE') +l = float(input('Informe a largura da parede:')) +h = float(input('Informe a altura da parede:')) +area=l*h + +print('Você vai precisar de {} litros de tinta para pintar essa parede de {} metros quadrados.'.format(area/2,area)) \ No newline at end of file diff --git a/exerc013.py b/exerc013.py new file mode 100644 index 0000000..a0c76e3 --- /dev/null +++ b/exerc013.py @@ -0,0 +1,7 @@ +print('Loja com Descontaço - Black Friday') + +p = float(input('Informe o preço do Produto: ')) +d = float(input('Informe quanto vai dar de desconto em %: ')) + +print('Caro cliente, o preço deste produto é R${} mas eu conversei com o gerente e consegui {}% de desconto. Então o produto vai ficar R${}. Parabéns'.format(p,d,p*((100-d)/100))) +print('Você economizou {}'.format(p*(d/100))) \ No newline at end of file diff --git a/exerc014.py b/exerc014.py new file mode 100644 index 0000000..f3d2511 --- /dev/null +++ b/exerc014.py @@ -0,0 +1,5 @@ +print('Aumento de Salário') +p = float(input('Informe o salário do Funcionário: ')) +d = float(input('Informe quanto vai dar de aumento em %: ')) + +print('Parabéns funcionário. Você conseguiu {}% de aumento de salário. Seu salário era R${} agora será de R${}. Você ganhou R${} a mais.'.format(d,p,p*((d+100)/100),p*(d/100))) \ No newline at end of file diff --git a/exerc015.py b/exerc015.py new file mode 100644 index 0000000..9cc8539 --- /dev/null +++ b/exerc015.py @@ -0,0 +1,9 @@ +print("Conversor de Temperaturas") +c = float(input("Informe a temperatura em ºC:")) + +f = (c*(9/5))+32 # 9/5 = 1.8 +k = (c + 273.15) + +#print('A temperatura {}ºC é {}ºF Fahrenheit e {}ºK Kelvin'.format(c,f,k)) + +print('A temperatura {0}ºC é {1}ºF Fahrenheit e {2}ºK Kelvin'.format(c,f,k)) \ No newline at end of file diff --git a/exerc016.py b/exerc016.py new file mode 100644 index 0000000..697b812 --- /dev/null +++ b/exerc016.py @@ -0,0 +1,6 @@ +print("Aluguel de Carros") +d = int(input('Quantos dias desejar alugar o carro:')) +km = int(input('Rodar quantos Km o carro:')) +fixo = 60 +diaria= 0.15 +print('o Valor a pagar por {} dias é: R${}'.format(d, d*fixo +(diaria*km))) \ No newline at end of file diff --git a/exerc017.py b/exerc017.py new file mode 100644 index 0000000..4f59ce3 --- /dev/null +++ b/exerc017.py @@ -0,0 +1,22 @@ +import emoji +import math +import random +num = random.randint(1,10) + +print(math.sqrt(num)) +print(num) + +print(emoji.emojize("Aqui é treta :earth_americas:",use_aliases=True)) + +print('*'*20) +print('Programa para exibir o número real') +n = float(input('Digite um número: ')) +aleatorio = n * random.random() + +print('[CEIL] O número {} tem a parte inteira {}'.format(n,math.ceil(n))) +print('[TRUNC] O número {} tem a parte inteira {}'.format(n,math.trunc(n))) +print('[COM FORMATACAO] O número {} tem a parte inteira {:.0f}'.format(n,n)) +print('[COM INT] O número {} tem a parte inteira {}'.format(n,int(n))) + + +print('Olha um aleatório doidão:',aleatorio) \ No newline at end of file diff --git a/exerc018.py b/exerc018.py new file mode 100644 index 0000000..6fdce02 --- /dev/null +++ b/exerc018.py @@ -0,0 +1,28 @@ +import random +import math +import emoji + +print('Calcular a Hipotenusa') +co = float(input('Digite o valor do Cateto Oposto:')) +ca = float(input('Digite o valor do Cateto Adjacente')) + +hip = math.sqrt(pow(co,2)+pow(ca,2)) +print(emoji.emojize("A hipotenusa deste :triangular_ruler: é {:.2f}",use_aliases=True).format(hip)) +print('-----'*20) +hip = math.hypot(co,ca) +print(emoji.emojize("A hipotenusa deste :triangular_ruler: é {:.2f}",use_aliases=True).format(hip)) +print('-----'*20) +print('\n') +print('####'*20) + +print('Calcular o Seno, Cosseno e Tangente') +ang = float(input('Informe o valor do ângulo: ')) +#s = co / hip +#c = ca / hip +#t = co / ca +ang_r = math.radians(ang) +s = math.sin(ang_r) +c = math.cos(ang_r) +t = math.tan(ang_r) + +print('O ângulo {0:.0f}º, tem {1:.2f} como SENO, {2:.2f} como COSSENO e {3:.2f} como TANGENTE'.format(ang,s,c,t)) \ No newline at end of file diff --git a/exerc019.py b/exerc019.py new file mode 100644 index 0000000..0acbfe7 --- /dev/null +++ b/exerc019.py @@ -0,0 +1,14 @@ +import random +print('Sortear nomes aleatórios') +a1 = str(input('Digite o nome do Aluno:')) +a2 = str(input('Digite o nome do Aluno:')) +a3 = str(input('Digite o nome do Aluno:')) +a4 = str(input('Digite o nome do Aluno:')) +sorteado = random.choice([a1,a2,a3,a4]) + + +print('Oi {}, você foi sorteado. Meus Parabéns. Pode ir apagar a lousa e trazer meu café.'.format(sorteado)) + +print('####'*20) +#lista= [a1,a2,a3,a4] +#print('Oi {}, você foi sorteado. Meus Parabéns. Pode ir apagar a lousa e trazer meu café.'.format(sorted(lista))) \ No newline at end of file diff --git a/exerc020.py b/exerc020.py new file mode 100644 index 0000000..cd327bd --- /dev/null +++ b/exerc020.py @@ -0,0 +1,18 @@ +import random +print('Sortear Ordem de Apresentação dos Alunos') +a1 = str(input('Digite o nome do Aluno:')) +a2 = str(input('Digite o nome do Aluno:')) +a3 = str(input('Digite o nome do Aluno:')) +a4 = str(input('Digite o nome do Aluno:')) + +sorteado = random.sample([a1,a2,a3,a4],k=4) + +print('[SIMPLE] Oi. Essa é a ordem de apresentação dos alunos: {}.'.format(sorteado)) +#o legal de usar o sample ao invés do shuffle é q da pra limitar a quantidade de pessoas q vão apresentar, atribuindo a quantidade no 'k', +# então se na lista tiverem 10 alunos inscritos +# mas o k for igual a 5 então serão escolhidos só 5 dentre os 10 alunos +# sample([aluno1, aluno2, aluno3, aluno4], k=2) -> serão escolhidos 2 dentre os 4 alunos +print('xxxxx'*20) +sorteado_shuffle = [a1,a2,a3,a4] +random.shuffle(sorteado_shuffle) +print('[SHUFFLE] Oi. Essa é a ordem de apresentação dos alunos: {}.'.format(sorteado_shuffle)) \ No newline at end of file diff --git a/exerc021.py b/exerc021.py new file mode 100644 index 0000000..33cb3dc --- /dev/null +++ b/exerc021.py @@ -0,0 +1,14 @@ +import vlc +import time +import random +import emoji + +musics = ['Giant.mp3','Rize_Up.mp3','Birds_in_Flight.mp3'] +musica = random.choice(musics) +s = vlc.MediaPlayer(("./mp3/{}".format(musica))) +print(emoji.emojize(':speaker: :musical_note: Dança ai Galera, a musica que está tocando é: {}',use_aliases=True).format(musica)) + +s.play() + +time.sleep(20) +s.stop() diff --git a/exerc022.py b/exerc022.py new file mode 100644 index 0000000..92ee777 --- /dev/null +++ b/exerc022.py @@ -0,0 +1,34 @@ +print('~~~'*50) +nome_completo = str(input('Digite o seu nome completo: ')) +print(nome_completo.upper()) +print(nome_completo.lower()) +print(len(nome_completo.strip())) +primeiro_nome = nome_completo.split() +print(primeiro_nome) +print('SEM ESPAÇO {} tem {} letras'.format(nome_completo.replace(' ',''),len(nome_completo.replace(' ','')))) +print('O primeiro nome {} tem {} letras'.format(primeiro_nome[0].upper(), len(primeiro_nome[0]))) +print('~~~'*50) +#frase = str(input('Digite uma frase: ')) +frase ='Eu sou Corinthiano Mano. Aqui tem um bando de louco' +print(frase[4]) +print(frase[4:11]) +print(frase[4:11:2]) +print(frase[:5]) +print(frase[5:]) +print(len(frase)) #comprimento +print(frase.count('o'))#contar quantas vezes tem a letra na analise +print(frase.find('ano'))#procurar a palavra +print('Corinthiano' in frase) + +print(frase.replace('Corinthiano','Palmeiras')) +print(frase.upper()) +print(frase.lower()) +print(frase.capitalize())#primeiro caracatere em maiusculo +print(frase.title())#todas as palavras inciias em maiusculo +print(frase.strip())#remove espalis em brancos inuteis da direita e esquerda +print(frase.rstrip())#remove espalis em brancos inuteis da direita +print(frase.lstrip())#remove espalis em brancos inuteis da esquerda +#divisão +print(frase.split())#aproveita o espaço em branco +print('X'.join(frase)) + diff --git a/exerc023.py b/exerc023.py new file mode 100644 index 0000000..fbfaef6 --- /dev/null +++ b/exerc023.py @@ -0,0 +1,20 @@ +import random +#https://wiki.python.org.br/ManipulandoStringsComPython +num = int(random.randint(0,9999)) +n = str(num) + +u = num//1 %10 +d = num//10 %10 +c = num//100 %10 +m = num//1000 %10 + +print('----'*20) +print('Analisando o número: {}'.format(num)) +print('Unidade : {}'.format(u)) +print('Dezena : {}'.format(d)) +print('Centena : {}'.format(c)) +print('Milhar : {}'.format(m)) + +print('----'*20) + + diff --git a/exerc024.py b/exerc024.py new file mode 100644 index 0000000..d99d357 --- /dev/null +++ b/exerc024.py @@ -0,0 +1,5 @@ +print('SUA CIDADE NATAL') + +cidade = str(input('Que cidade você nasceu? ')).upper().strip() + +print('SANTO' in cidade) \ No newline at end of file diff --git a/exerc025.py b/exerc025.py new file mode 100644 index 0000000..3aa7816 --- /dev/null +++ b/exerc025.py @@ -0,0 +1,4 @@ +print('~~~'*50) +nome_completo = str(input('Digite o seu nome completo: ')).strip().upper() +sobrenomes = ['SILVA', 'QUEIROZ'] +print(sobrenomes[0] in nome_completo) \ No newline at end of file diff --git a/exerc026.py b/exerc026.py new file mode 100644 index 0000000..04467c2 --- /dev/null +++ b/exerc026.py @@ -0,0 +1,8 @@ +print('~~~'*50) +frase = str(input('Digite uma frase: ')).upper().strip() + +print(frase.count('A',0,len(frase))) +print(frase.count('A')) + +print('Primeira vez que aparece a letra A é na posição {}'.format(frase.find('A',0)+1)) +print('Última vez que aparece a letra A é na posição {}'.format(frase.rfind('A',0)+1)) \ No newline at end of file diff --git a/exerc027.py b/exerc027.py new file mode 100644 index 0000000..45117e7 --- /dev/null +++ b/exerc027.py @@ -0,0 +1,7 @@ +print('~~~'*50) +nome_completo = str(input('Digite o seu nome completo: ')).strip().upper() + +nome = nome_completo.split() +print(nome) + +print('Seu primerio nome é {} e último nome é {}'.format(nome[0],nome[-1])) \ No newline at end of file diff --git a/exerc028.py b/exerc028.py new file mode 100644 index 0000000..ad45747 --- /dev/null +++ b/exerc028.py @@ -0,0 +1,14 @@ +import random +from time import sleep +print('-==-'*50) +print('vou pensar em um número entre 0 e 5. Tente advinhar bruxo...') +print('-==-'*50) +n = int(random.randint(0,5)) +u = int(input('Em que número eu pensei?: ')) +print('PROCESSANDO') +sleep(3) +if(n==u): + print('Revelando o meu número {}. Você acertou.'.format(n)) +else: + print('Revelando o meu número {}. Você errou.'.format(n)) + diff --git a/exerc029.py b/exerc029.py new file mode 100644 index 0000000..ec23553 --- /dev/null +++ b/exerc029.py @@ -0,0 +1,13 @@ +import random +from time import sleep +print('-==-'*50) +print('RADAR ELETRÔNICO') +print('-==-'*50) +multa = 7 +v = float(input('Qual é a velocidade atual do Carro?:')) + +if(v<=80): + print('Parabéns. Dirija com segurança') +else: + print('RADAR. Você está acima da velocidade permitida. Você está á {:.0f}km/h enquanto a velocidade permitida é 80km/h'.format(v)) + print('Você terá que pagar uma multa de R${:.2f} e 7 pontos na carteira. Na próxima vez, respeite os limites.'.format(v-80)*multa) \ No newline at end of file diff --git a/exerc030.py b/exerc030.py new file mode 100644 index 0000000..a89b3ca --- /dev/null +++ b/exerc030.py @@ -0,0 +1,10 @@ +print('-==-'*50) +print('PAR OU IMPAR') +print('-==-'*50) +n= int(input('Digite um número qualquer: ')) + +x =n%2 +if(x==0): + print('O seu número é PAR') +else: + print('O seu número é ÍMPAR') diff --git a/exerc031.py b/exerc031.py new file mode 100644 index 0000000..41a398e --- /dev/null +++ b/exerc031.py @@ -0,0 +1,13 @@ +print('-==-'*50) +print('VALOR DA PASSAGEM') +print('-==-'*50) +v = float(input('Informe a Distância da viagem em km: ')) + +if(v<=200): + print('O valor da sua passagem é R${:.2f}'.format(v*0.50)) +else: + print('O valor da sua passagem é R${:.2f}'.format(v * 0.45)) +print('\nIF OTIMIZADO. IF INLINE') +preco=v * 0.50 if v<=200 else v*0.45 +print('O valor da sua passagem é R${:.2f}'.format(preco)) + diff --git a/exerc032.py b/exerc032.py new file mode 100644 index 0000000..669d74e --- /dev/null +++ b/exerc032.py @@ -0,0 +1,14 @@ +from datetime import date +print('-==-'*50) +print('ANO BISSEXTO') +print('\nChama-se ano bissexto o ano ao qual é acrescentado um dia extra, ficando com 366 dias, um dia a mais do que os anos normais de 365 dias, ocorrendo a cada quatro anos (exceto anos múltiplos de 100 que não são múltiplos de 400).\n Isto é feito com o objetivo de manter o calendário anual ajustado com a translação da Terra e com os eventos sazonais relacionados às estações do ano. O ano presente (2020) é bissexto.\n O ano bissexto anterior foi 2016 e o próximo será 2024.') +print('-==-'*50) + +ano = int(input('Qual ano quer analisar? Coloque 0 para o ano atual: ').upper()) +if (ano==0): + ano = date.today().year +if(ano % 4 == 0 and ano % 100 !=0 or ano % 400 == 0): + print('O ano {} é BISSEXTO'.format(ano)) +else: + print('O ano {} NÃO é BISSEXTO'.format(ano)) + diff --git a/exerc033.py b/exerc033.py new file mode 100644 index 0000000..c3a7707 --- /dev/null +++ b/exerc033.py @@ -0,0 +1,13 @@ +print('-==-'*50) +print('MAIOR E MENOR VALORES') +print('-==-'*50) +n1 = float(input('Informe o 1º número: ')) +n2 = float(input('Informe o 2º número: ')) +n3 = float(input('Informe o 3º número: ')) +ordena_numeros = [n1,n2,n3] +ordena_numeros.sort(reverse=True) +print(ordena_numeros) +print('O MENOR número é {} e o MAIOR número é {}'.format(ordena_numeros[-1],ordena_numeros[0])) +print('\n') +print('O maior valor digitado foi {}'.format(max(ordena_numeros))) +print('O menor numero digitado foi {}'.format(min(ordena_numeros))) \ No newline at end of file diff --git a/exerc034.py b/exerc034.py new file mode 100644 index 0000000..691cf76 --- /dev/null +++ b/exerc034.py @@ -0,0 +1,8 @@ +print('-==-'*50) +print('AUMENTO MÚLTIPLO DO SALÁRIO DO MAN') +print('-==-'*50) +func=float(input('Qual é o salário do funcionário? R$')) + +aumento_salario=func * 1.15 if func<=1250 else func*1.10 + +print('Funcionário, parabéns o seu salário de R${:.2f} agora é R${:.2f}. O seu aumento foi de R${:.2f}'.format(func,aumento_salario,aumento_salario-func)) \ No newline at end of file diff --git a/exerc035.py b/exerc035.py new file mode 100644 index 0000000..b26f3c0 --- /dev/null +++ b/exerc035.py @@ -0,0 +1,23 @@ +print('-==-'*50) +print('ANALISANDO O TRIÂNGULO') +print('-==-'*50) + +print('Para construir um triângulo é necessário que a medida de qualquer um dos lados seja menor que a soma das medidas dos outros dois e maior que o valor absoluto da diferença entre essas medidas.') + +s1=float(input('Primeiro seguimento: ')) +s2=float(input('Segundo seguimento: ')) +s3=float(input('Terceiro seguimento: ')) + + +if(s1 < s2+s3 and s2 < s1+s3 and s3 num2): + print('O número {} é MAIOR que {}'.format(num1,num2)) +elif (num1maior): + maior=peso + if(peso0: + fat = fat * z + conjunto +=''.join(str(z))+(' x ' if z>1 else ' = {}'.format(fat)) + + #print('{} X '.format(z),end='') + z-=1 + +print('O fatorial de {}! é {}'.format(n,fat)) +print('A sequência é:{0}'.format(conjunto)) \ No newline at end of file diff --git a/exerc061.py b/exerc061.py new file mode 100644 index 0000000..0ab9ce0 --- /dev/null +++ b/exerc061.py @@ -0,0 +1,14 @@ +print('-==-'*50) +print('EXÉRCICIO 61 - Progressão Aritmética com While') +print('-==-'*50) + +a = int(input('Informe o primeiro termo da PA: ')) +r = float(input('Informe a razão da PA: ')) +an=a + +x = 1 +while x<11: + print('Termo {}º - é {:.2f} '.format(x,an)) + an = an + r + x+=1 + diff --git a/exerc062.py b/exerc062.py new file mode 100644 index 0000000..33f7da8 --- /dev/null +++ b/exerc062.py @@ -0,0 +1,28 @@ +print('-==-'*50) +print('EXÉRCICIO 62 - Progressão Arimética FODONA ') +print('-==-'*50) + +a = int(input('Informe o primeiro termo da PA: ')) +r = float(input('Informe a razão da PA: ')) +an=a +ate=10 +x = 1 +acumulador=0 +numeros=[] + +while x<=ate or ate==0: + acumulador+=1 + numeros.append(an) + print("{} → ".format(an), end='') + an = an + r + x+=1 + if(x==ate): + mais_termos = int(input('\nQuantos termos a mais quer visualizar?: ')) + ate+=mais_termos + +print('\nVocê viu {} termos.'.format(acumulador)) +print('NUMEROS: {}'.format(numeros)) +print('SOMA: {}'.format(sum(numeros))) +print('MAIOR: {}'.format(max(numeros))) +print('MENOR: {}'.format(min(numeros))) +print('MEDIA: {}'.format(sum(numeros)/len(numeros))) diff --git a/exerc063.py b/exerc063.py new file mode 100644 index 0000000..06a873a --- /dev/null +++ b/exerc063.py @@ -0,0 +1,24 @@ +import math +print('-==-'*50) +print('EXÉRCICIO 63 - SUQÊNCIA DE FIBONACCI ') +print('-==-'*50) + +n = int(input('Informe termos quer mostrar: ')) +numeros = [] +fib = [0,1] +c=2 +while c=18: + maiores18+=1 + if sexo in 'Mm': + homens+=1 + else: + if idade < 20: + mulheres_20+=1 + r=str(input('\nDeseja Cadastrar mais alguma pessoa?[S/N]')) + if r in 'Nn': + break + + +print(f'\nQuantidade de Homens {homens}\nMaiores de 18 anos {maiores18}\nMulheres com menos de 20 anos {mulheres_20}') diff --git a/exerc070.py b/exerc070.py new file mode 100644 index 0000000..ee2b61f --- /dev/null +++ b/exerc070.py @@ -0,0 +1,23 @@ +print('-==-'*50) +print('EXÉRCICIO 70 - ANALISANDO DADOS') +print('-==-'*50) +produtos=[] +precos=[] +mais1000=0 +while True: + produto = str(input('Digite o nome do produto: ')).strip().upper() + preco = float(input('Digite o Preço do Produto: R$')) + if preco > 999: + mais1000+=1 + produtos.append(produto) + precos.append(preco) + + r=str(input('\nDeseja Cadastrar mais algum produto?[S/N]')) + if r in 'Nn': + break + +print(f'TOTAL GASTO: R${sum(precos):.2f}') +print(f'PRODUTO MAIS BARATO: {produtos[precos.index(min(precos))]} - R${min(precos):.2f}') +print(f'PRODUTOS MAIS CAROS DO QUE R$1.000,00 {mais1000}') + + diff --git a/exerc071.py b/exerc071.py new file mode 100644 index 0000000..f28d2b5 --- /dev/null +++ b/exerc071.py @@ -0,0 +1,27 @@ +print('-==-'*50) +print('EXÉRCICIO 71 - BANCO GREGMASTER') +print('-==-'*50) +cedulas=[100,50,20,10,5,2,1] #Pode causar um problema, por exemplo, um random em que interrompe o fornecimento de dinheiro ou o usuario escolhe as notas que quer receber. Basta operacionalizar a lista notas. +valor=int(input('Que valor quer sacar? R$')) +sacar = valor +notas_entregue=[] +c=-1 +while True: + if sacar >0: + c+=1 + while True: + if sacar / cedulas[c] < 1: + break + else: + sacar = sacar - cedulas[c] + #print(f'{c} - VALOR LIBERADO: R$ {cedulas[c]} - DEVEDOR: {sacar}') + notas_entregue.append(c) + if sacar ==0: + break +print('\JÁ LIBEREI SEU DINHEIRO. AGORA PAGA JUROS PRA MIM') +print('CONFIRA SUA NOTAS AÍ. TE PAGUEI ASSIM: ') + +for x in range(0,len(cedulas)): + if notas_entregue.count(x)> 0: + print(f'{notas_entregue.count(x)} nota(s) de R${(cedulas[x])} reais') +print(f'\nTOTALIZANDO = R${valor} reais ') diff --git a/exerc072.py b/exerc072.py new file mode 100644 index 0000000..f282a22 --- /dev/null +++ b/exerc072.py @@ -0,0 +1,26 @@ +print('-==-'*50) +print('AULA 16# TUPLAS - EXERCÍCIO 72') +print('-==-'*50) +print('AS TUPLAS SÃO IMUTÁVEIS!!!') +lanche=('A',1,5.5,'B') +lanche is tuple +for c in lanche: + print(c) + +for cont in range(0, len(lanche)): + print(f'{lanche[cont]} -- {cont}') + +for pos, c in enumerate(lanche): + print(c,pos) +print('-==-'*50) +print('EXERCÍCIO 72 - TUPLA PREENCHIDA') +print('-==-'*50) + +numeros=('zero','um', 'dois', 'tres', 'quatro','cinco','seis','sete','oito','nove','dez','onze','doze','treze','quatorze','quinze','dezesseis','dezesete','dezoito','dezenove','vinte') + +while True: + n=int(input('Digite um número: ')) + if n<0 or n > 20: + print('Número Inválido. Digite entre 0 e 20') + else: + print(f'{n} => {numeros[n].upper()}') diff --git a/exerc073.py b/exerc073.py new file mode 100644 index 0000000..17fc7a8 --- /dev/null +++ b/exerc073.py @@ -0,0 +1,27 @@ +print('-==-'*50) +print('EXERCÍCIO 73 - CORINTHIANS CAMPEÃO DO BRASILEIRÃO DE 2017') +print('-==-'*50) + +classificacao=('','Corinthians','Palmeiras','Santos','Grêmio','Cruzeiro','Flamengo','Vasco','Chapecoense','Atlético-MG','Botafogo','Atlético-PR','Bahia','São Paulo','Fluminense','Sport','Vitória','Coritiba','Avaí','Ponte Preta','Atlético-GO') + +print('CLASSIFICAÇÃO CAMPEONATO BRASOLEIRO - 2017') +for pos,clube in enumerate(classificacao): + if pos>0: + print(f'{pos}º - {clube}') + + +print('\nCLASSIFICADOS LIBERTADORES 2018') +print(classificacao[0:6]) +for libertadores in range(1, 6): + print(f'{libertadores}º - {classificacao[libertadores]}') + +print('\nREBAIXADOS PARA O CAMPEONATO DA SÉRIE B 2018') +for pos,clube in enumerate(classificacao): + if pos>16: + print(f'{pos}º - {clube}') + +print('\nCLUBES QUE PARTICIPARAM DO CAMPEONATO BRASILEIRO 2017 - AZ') +for cont in range(1, len(classificacao)): + print(f'{sorted(classificacao)[cont]}') + +print(f'\nA Chapecoense ficou em {classificacao.index("Chapecoense")}º no Campeonato Brasileiro de 2017') \ No newline at end of file diff --git a/exerc074.py b/exerc074.py new file mode 100644 index 0000000..8dd33cb --- /dev/null +++ b/exerc074.py @@ -0,0 +1,13 @@ +import random +print('-==-'*50) +print('EXERCÍCIO 74 - NÚMEROS ALEATÓRIOS NA TUPLA') +print('-==-'*50) +numeros=(random.randint(1,10),random.randint(1,10),random.randint(1,10),random.randint(1,10),random.randint(1,10)) +#numeros=(random.randint(1,10),*5)) + + +for n in numeros: + print(f'{n} ',end='') +#print(numeros) +print(f'\nMAIOR: {max(numeros)}') +print(f'MENOR: {min(numeros)}') \ No newline at end of file diff --git a/exerc075.py b/exerc075.py new file mode 100644 index 0000000..cb67c1d --- /dev/null +++ b/exerc075.py @@ -0,0 +1,24 @@ +import random +print('-==-'*50) +print('EXERCÍCIO 75 - NÚMEROS ALEATÓRIOS NA TUPLA') +print('-==-'*50) + +numeros=(random.randint(3,9),random.randint(3,9),random.randint(3,9),random.randint(3,9),random.randint(3,9)) + +print(numeros) +if 9 in numeros: + print(f'O número 9 apareceu: {numeros.count(9)} vezes') +else: + print(f'O número 9 NÃO APARECEU') +#print(f'O número 3 apareceu na posição: {numeros.index(3)}ª') +if 3 in numeros: + print(f'O número 3 apareceu na posição: {numeros.index(3)+1}ª') +else: + print('O número 3 não foi sorteado na lista') + +print('Os números Pares Sorteados foram: ',end='') +for pos,n in enumerate(numeros): + if n%2==0: + print(f'{n} ',end='') + +print('\n') diff --git a/exerc076.py b/exerc076.py new file mode 100644 index 0000000..d072c8c --- /dev/null +++ b/exerc076.py @@ -0,0 +1,29 @@ +import random +print('-==-'*50) +print('EXERCÍCIO 76 - LISTA DE COMPRAS') +print('-==-'*50) + +print("#"*40) +print(f'{"MERCADO GREGMASTER":^40}') +print("#"*40) +compras=('Pão',1,'Leite',3.50,'Maça',5.00,'Arroz',11.50,'Bife',19.85) +print(f'{"Produtos":<28}{"Preço (R$)"}') +print('-'*40) +for c in range(0,len(compras),2): + print(f'{compras[c]:.<30}R$ {compras[c+1]:0.2f}') +print('-'*40) + + +print('\n\n') +nome='Gregorio' +print("Prazer em te conhecer {}!".format(nome)) +print("#"*10) +print("[ESCREVE COM 20 ESPACO]Prazer em te conhecer {:20}!".format(nome)) +print("#"*10) +print("[ALINHADO A DIREITA 20 ESPACO]Prazer em te conhecer {:>20}!".format(nome)) +print("#"*10) +print("[ALINHADO A ESQUERDA 20 ESPACO]Prazer em te conhecer {:<20}!".format(nome)) +print("#"*10) +print("[CENTRALIZADO]Prazer em te conhecer {:^20}!".format(nome)) +print("#"*10) +print("[CENTRALIZADO COM UM SIMBOLO]Prazer em te conhecer {:=^20}!".format(nome)) \ No newline at end of file diff --git a/exerc077.py b/exerc077.py new file mode 100644 index 0000000..56d3869 --- /dev/null +++ b/exerc077.py @@ -0,0 +1,14 @@ +import random +print('-==-'*50) +print('EXERCÍCIO 77 - TUPLA VÁRIAS PALAVRAS E PROCURAR A VOGAL ') +print('-==-'*50) + +palavras = ('Gregorio','Almeida','Queiroz','Amanda','Altava','Palhares','Se','Amam') +vogais ='aeiou' + +for p in range (0,len(palavras)): + palavra = palavras[p].lower() + print(f'\nNa Palavra {palavra.upper()} temos ', end='') + for l in range(0,len(palavra)): + if (palavra[l]) in vogais: + print(f'{palavra[l]}, ', end='') diff --git a/exerc078.py b/exerc078.py new file mode 100644 index 0000000..3f9f013 --- /dev/null +++ b/exerc078.py @@ -0,0 +1,66 @@ +print('-==-'*50) +print('AULA 17 - PARTE 1 LISTAS ') +print('-==-'*50) + +lanches = ['hamburguer','coca-cola','pizza','sorvete'] +print(f'{lanches}') +#adicionar um elemento da lista +lanches.append('pudim') +print(f'{lanches}') +lanches.insert(0,'Pão') +print(f'{lanches}') +#remover um item da lista +del lanches[0] +print(f'{lanches}') +lanches.pop() #lanches.pop(-1) +print(f'{lanches}') +lanches.remove('pizza') +print(f'{lanches}') + +if 'pizza' in lanches: + lanches.remove('pizza') + +valores = list(range(4,11)) +print(valores) + +valores2 = list(range(1,21,2)) +print(valores2) +#ordenar é o método sort() parametro reverse=True - ordem inversa +valores2.sort(reverse=True) +print(valores2) +print(len(valores2)) + +for c,v in enumerate(valores2): + print(f'Na posição {c} encontrei o valor {v}') +valores3 = list() + +for cont in range(0,5): + valores3.append(int(input('Digite um valor: '))) + +print(valores3) +#Propriedades +a =[2,3,4,7] +b=a +print(a) +print(b) +#-> O phyton cria uma LIGAÇÃO/VINCULO FORTE entre as listas. Se eu alterar B, vai mudar A +b[2] =8 +print(a) +print(b) +#Para criar uma cópia precisa usar o o parametro : +c = a[:] #Apenas Copia, não tem vínculo +print(c) +c[2] = 20 +print(c) + + + +print('-==-'*50) +print(' EXERCÍCIO 78 - LISTAS LER 5 NÚMEROS E MOSTRAR O MAIOR E MENOR') +print('-==-'*50) +num = list() +for x in range(0,5): + num.append(int(input('Digite um valor: '))) +print(num) +print(f'O maior valor é {max(num)}. Ele está na posição: {num.index(max(num))}') +print(f'O menor valor é {min(num)}. Ele está na posição: {num.index(min(num))}') \ No newline at end of file diff --git a/exerc079.py b/exerc079.py new file mode 100644 index 0000000..137c318 --- /dev/null +++ b/exerc079.py @@ -0,0 +1,26 @@ +print('-==-'*50) +print(' EXERCÍCIO 79 - LISTAS LER NÚMEROS ALEATORIAMENTE E NÃO DEIXAR ENTRAR NÚMEROS DUPLICADOS. NO FINAL É COLOCADO EM ORDEM') +print('-==-'*50) +num = list() +print('Digite números aleatproriamente. o -1 para de receber') +while True: + n = int(input('Digite um valor: ')) + if n<0: + break + else: + if n not in num: + num.append(n) +if len(num)>0: + print('Olha os números dígitados') + print(num) + print('Os números ordenados') + num.sort() + print(num) +else: + print('NÃO FOI DIGITADO NENHUM NÚMERO') + + + + + + diff --git a/exerc080.py b/exerc080.py new file mode 100644 index 0000000..e8cd82b --- /dev/null +++ b/exerc080.py @@ -0,0 +1,18 @@ +print('-==-'*50) +print(' EXERCÍCIO 80 - LISTAS LER 5 NÚMEROS E MOSTRAR O MAIOR E MENOR') +print('-==-'*50) +num = list() +print('Digite números aleatoriamente e organizar os numeros sem o SORT') + +for i in range(0,5): + n=int(input(f'Digite o {i+1}º número: ')) + if i==0 or n > num[-1]: + num.append(n) + else: + p=0 + while p < len(num): + if n <= num[p]: + num.insert(p, n) + break + p += 1 +print(num) diff --git a/exerc081.py b/exerc081.py new file mode 100644 index 0000000..eb59fd1 --- /dev/null +++ b/exerc081.py @@ -0,0 +1,21 @@ +print('-==-'*50) +print(' EXERCÍCIO 81 - LISTAS LER VARIOS NÚMEROS NÚMEROS E QUANTOS NUMEROS, ORDEM E SE O CINCO TA LISTA') +print('-==-'*50) +numeros = [] +while True: + n = int(input(f'Digite um número: ')) + if n < 0: + break + else: + numeros.append(n) +print(f'Quantidade de números digitados: {len(numeros)}') +print(f'Ordem Original: {numeros}') +num = numeros[:] +num.sort() +print(f'Ordem decrescente: {num}') +x = int(input(f'Digite um número para procurar na lista: ')) +if x in num: + print(f'O número {x} está na lista') +else: + print(f'O número {x} não está na lista') + diff --git a/exerc082.py b/exerc082.py new file mode 100644 index 0000000..da03e5b --- /dev/null +++ b/exerc082.py @@ -0,0 +1,27 @@ +print('-==-'*50) +print(' EXERCÍCIO 82 - LISTAS LER VARIOS NÚMEROS NÚMEROS E SEPARAAR EM PARE E IMPAR') +print('-==-'*50) +numeros = [] +par = [] +impar = [] +while True: + n = int(input(f'Digite um número: ')) + if n < 0: + break + else: + numeros.append(n) + if n%2==0: + par.append(n) + else: + impar.append(n) + +print(f'Quantidade de números digitados: {len(numeros)}') +print(f'Ordem Original: {numeros}') +if len(par)>0: + print(f'PARES: {par}') +else: + print('NÃO FOI INFORMADO NÚMERO PAR') +if len(impar)>0: + print(f'IMPARES: {impar}') +else: + print('NÃO FOI INFORMADO NÚMERO ÍMPAR') diff --git a/exerc083.py b/exerc083.py new file mode 100644 index 0000000..6f66941 --- /dev/null +++ b/exerc083.py @@ -0,0 +1,39 @@ +print('-==-'*50) +print(' EXERCÍCIO 83 - VERIFICAR SE A EXPRESSÃO É VÁLIDA') +print('-==-'*50) + +expressao = str(input('Digite uma expressão: ')) +#Dessa maneira aceita uns bugs. +abriu=expressao.count('(') +fechou=expressao.count(')') + + +print(abriu) +print(fechou) + +if(abriu==fechou): + print(expressao.index('('), expressao.index(')')) + if expressao.index('(') > expressao.index(')'): + print('EXPRESSÃO NAO É VÁLIDA') + else: + print('EXPRESSÃO É VÁLIDA') +else: + print('EXPRESSÃO NAO É VÁLIDA') + +#GUANABARA +pilha = [] + +for s in expressao: + if s =='(': + pilha.append('(') + elif s==')': + if len(pilha)>0: + pilha.pop() + else: + pilha.append(')') + break +if len(pilha) == 0: + print('[GUANABARA] EXPRESSÃO É VÁLIDA') +else: + print('[GUANABARA] EXPRESSÃO NÃO É VÁLIDA') + diff --git a/exerc084.py b/exerc084.py new file mode 100644 index 0000000..d56b678 --- /dev/null +++ b/exerc084.py @@ -0,0 +1,21 @@ +print('-==-'*50) +print(' EXERCÍCIO 84 - ANÁLISE DE DADOS') +print('-==-'*50) +pessoas = [] +while True: + n = str(input('Nome: ')).upper().strip() + p = float(input('Peso (kg): ')) + pessoas.append([n,p]) + r = str(input('Deseja Continuar? [S/N]')).upper().strip()[0] + if r in 'Nn': + break +print(pessoas) +print(f'Foram cadastradas {len(pessoas)} pessoas') +print(f'Ordem das pessoas LEVEs ') +pessoas.sort(key=lambda x:x[1]) +for pes in pessoas: + print(pes) +print(f'Ordem das pessoas PESADAS') +pessoas.sort(key=lambda x:x[1], reverse=True) +for pes in pessoas: + print(pes) \ No newline at end of file diff --git a/exerc085.py b/exerc085.py new file mode 100644 index 0000000..c418dfc --- /dev/null +++ b/exerc085.py @@ -0,0 +1,16 @@ +print('-==-'*50) +print(' EXERCÍCIO 85 - RECEBENDO OS VALORES') +print('-==-'*50) +num = [[],[],[]] +n = -1 +for i in range(0,7): + n=int(input(f'Digite o {i+1}º valor: ')) + num[0].append(n) + if n % 2 == 0: + num[2].append(n) #PAR + else: + num[1].append(n) #IMPAR + +print(num) +print(f'Os PARES são: {sorted(num[2])}') +print(f'Os ÍMPARES são: {sorted(num[1])}') diff --git a/exerc086.py b/exerc086.py new file mode 100644 index 0000000..9ef5c45 --- /dev/null +++ b/exerc086.py @@ -0,0 +1,27 @@ +print('-==-'*50) +print(' EXERCÍCIO 86 - MATRIZ 3X3 - DIMENSIONAL') +print('-==-'*50) +matriz = [] +x=y=3 +for i in range(x): + matriz.append([0]*y) + for j in range(y): + matriz[i][j] = int(input(f'Digie o valor [{i+1}]x[{j+1}]: ')) +print(matriz) +print('\n') +for lin in range(0,x): + for col in range(0,y): + print(f'[{matriz[lin][col]:^5}]',end='') + print() + +print('\n') +matriz = [[],[],[]] +for l in range(0,3): + for c in range(0,3): + matriz[l].append(int(input(f"Digite um valor para [{l},{c}]: "))) +print('-='*30) + +for l in range(0,3): + for c in range(0,3): + print(f'[{matriz[l][c]:^5}]', end='') + print() \ No newline at end of file diff --git a/exerc087.py b/exerc087.py new file mode 100644 index 0000000..6dccb95 --- /dev/null +++ b/exerc087.py @@ -0,0 +1,43 @@ +print('-==-'*50) +print(' EXERCÍCIO 87 - MELHORAR MATRIZ 3X3 - DIMENSIONAL') +print('-==-'*50) +soma_3col = pares = 0 + +matriz = [[],[],[]] +for l in range(0,3): + for c in range(0,3): + n = int(input(f"Digie o valor [{l+1}]x[{c+1}]: ")) + matriz[l].append(n) + pares = pares + n if n % 2 == 0 else pares + if c==2: + soma_3col+= n +print('-='*30) + +for l in range(0,3): + for c in range(0,3): + print(f'[{matriz[l][c]:^5}]', end='') + print() +print(f"Soma dos valores Pares é: {pares}: ") + + +print(f'[MAP] A SOMA DA MATRIZ É: {sum(map(sum, matriz))}') +print(f'[FOR] A SOMA DA MATRIZ É: {sum(sum(x) for x in matriz)}') +print(f'A SOMA DA 3 COLUNA É: {soma_3col}') +print(f'A SOMA DA DOS PARES É: {pares}') +print(f'DA ERRADO - O MAIOR VALOR É: {max(max(matriz[:][:]))}') +print(max(matriz[:][:])) +maior = 0 + +for z in range(0,3): + if z==0: + maior=matriz[1][c] + elif matriz[1][c]> maior: + mai = matriz[1][c] + +print(f'O MAIOR VALOR DA SEGUNDA LINHA É? {maior}') + + +#NAO FUNCIONOUprint(f'[FOR] A SOMA DOS PARES É: {sum(sum(x if x % 2 == 0 else 0) for x in matriz)}') + + + diff --git a/exerc088.py b/exerc088.py new file mode 100644 index 0000000..8e0d942 --- /dev/null +++ b/exerc088.py @@ -0,0 +1,37 @@ +from random import randint +from time import sleep +print('-==-'*50) +print(' EXERCÍCIO 88 - JOGANDO MEGASENA') +print('-==-'*50) +jogos = [] +jogo = [] +n=0 +j=0 +print('JOGO DA MEGA SENA') +j = int(input('Quantos JOGOS quer que eu sorteie? ')) +preço = 4.5*j + +while j>0: + while True: + n = randint(1, 60) + #print(n) + if n not in jogo: + jogo.append(n) + + if len(jogo) == 6: + print(f'{len(jogos)+1}º JOGO - Olha o jogo feito: {jogo}') + sleep(0.5) + jogos.append(jogo) + #jogo.clear() + jogo = [] + break + j-=1 + if j<1: + break +print() +print(f'VOCÊ PRECISA PAGAR R${preço:.02f}.\nOlha os Jogos realizados: \n{jogos}') +print() +print('FOR') +for jg in jogos.sort(): + print(jg) + diff --git a/exerc089.py b/exerc089.py new file mode 100644 index 0000000..b006a0f --- /dev/null +++ b/exerc089.py @@ -0,0 +1,31 @@ +print('-==-'*50) +print(' EXERCÍCIO 89 - MEDIA ESCOLAR ALUNOS') +print('-==-'*50) +alunos=[] +while True: + nome = str(input('NOME: ')).upper().strip() + + nota1 = float(input('NOTA 1 : ')) + nota2 = float(input('NOTA 2 : ')) + alunos.append([nome,nota1,nota2]) + r = str(input('DESEJA CONTINUAR? [S/N]')).upper().strip()[0] + if r in 'Nn': + break +print() +print('MÉDIA APROVAÇÃO - ESCOLA GREGMASTER') +#print(alunos) +print('-'*50) +print(f'{"#":<4} {"NOME":1<0} {"MÉDIA":>8}') +print('-'*50) +for pos,c in enumerate(alunos): + #print(c) + print(f'{pos+1:<4} {c[0]:<10} {sum(c[1:])/2:.02f}') +print() +while True: + idAluno = int(input('Informe o Id do Aluno para Pesquisar : ')) + + if idAluno>len(alunos): + print('FINALIZANDO') + else: + idAluno-=1 + print(f" As notas do {alunos[idAluno][0]} - foram NOTA 1: {alunos[idAluno][1]} e NOTA 2: {alunos[idAluno][2]} ") \ No newline at end of file diff --git a/exerc090.py b/exerc090.py new file mode 100644 index 0000000..414a8f0 --- /dev/null +++ b/exerc090.py @@ -0,0 +1,77 @@ +import random +print('-==-'*50) +print('AULA 19 - VARIÁVEIS COMPOSTAS - DICIONÁRIOS') +print('-==-'*50) + +#REVISAO +#= TUPLAS () +#= LISTA [] +#= DICIONÁRIOS {} + +dados = dict() # dados={} + +dados={'nome':'Gregorio','idade':29,'sexo':'M','nome':'Amanda','idade':31,'sexo':'F'} +print(dados) +del dados['sexo'] +dados['peso']=50 +print(dados) +filmes={ + 'titulo':'Star Wars' , + 'ano':1977 , + 'diretor':'George Lucas' + + } +print(filmes) +print(filmes.values()) +print(filmes.keys()) +print(filmes.items()) +print() + +for k,v in filmes.items(): + print(f'O {k} é {v}') +print('\n') +brasil = [] +estado_1 = {'uf':'Rio de Janeiro','sigla':'RJ'} +estado_2 = {'uf':'São Paulo','sigla':'SP'} +brasil.append(estado_1) +brasil.append(estado_2) +print(brasil[0]) +print(brasil[0]['sigla']) +print(brasil) + +estado = dict() +brasil = list() + +for c in range(0,3): + estado['uf']=str(input('Unidade Federativa: ')).upper().strip() + estado['sigla']=str(input('Sigla do Estado: ')).upper().strip()[:2] + estado['populacao'] = float(input('População: ')) + estado['governador'] = str(input('Governador: ')) + brasil.append(estado.copy()) +print(brasil) +print('\n') +for e in brasil: + for k,v in estado.items(): + print(f'O Campo {k} tem o valor {v}') +print('\n') +def nomeExercicio(e,titulo): + print('-==-'*50) + print(f'{"":^60}EXERCÍCIO {e} - {titulo}') + print('-==-'*50) +nomeExercicio(90,'SITUAÇÃO DO ALUNO E MÉDIA') +alunos = dict() +alunos["nome"] = str(input('Nome do Aluno: ')) +alunos["nota1"] = float(input('Nota 1: ')) +alunos["nota2"] = float(input('Nota 2: ')) +alunos["media"] = (alunos["nota1"]+alunos["nota2"])/2 + +if alunos["media"]<5: + alunos["situacao"]='REPROVADO' +elif alunos["media"]<7: + alunos["situacao"] = 'RECUPERACAO' +else: + alunos["situacao"] = 'APROVADO' + +print(alunos) +for k,v in alunos.items(): + print(f'O Campo {k} tem o valor {v}') \ No newline at end of file diff --git a/exerc091.py b/exerc091.py new file mode 100644 index 0000000..b88e201 --- /dev/null +++ b/exerc091.py @@ -0,0 +1,43 @@ +from random import randint + + +def nomeExercicio(e,titulo): + print('-==-'*50) + print(f'{"":^60}EXERCÍCIO {e} - {titulo}') + print('-==-'*50) +nomeExercicio(91,'Jogando Dados - 4 jogadores') +j=1 +sorteioDados = [] +jogador={} + +while j<5: + num = randint(1, 6) + jogador={'jogador':j,'dado':num} + #sorteioDados.append(jogador) + sorteioDados.append(jogador.copy()) + print(f'O jogador {j}º tirou {num}') + j+=1 +print("RANKING DOS CLASSIFICAÇÃO") + +#for k,v in enumerate(sorteioDados): +# print(f'O {k} é {v}') +#print('\n') + +OrdenandoListaPeloDadosMaior = sorted(sorteioDados, key=lambda k: k['dado'],reverse=True) +print(OrdenandoListaPeloDadosMaior) +print(sorteioDados) +j=1 +print("RANKING DOS CLASSIFICAÇÃO") +for v in (OrdenandoListaPeloDadosMaior): + print(f'{j}º lugar - O jogador {v["jogador"]}º - tirou no dado {v["dado"]}') + j+=1 +print('\n') + + + +#print(sorted(sorteioDados)) +#for i in sorted (sorteioDados) : +# print ((i, sorteioDados[i]), end =" ") + +#alternativa - importar o método itemgetter da lib operator +#OrdenandoListaPeloDadosMaior = sorted(sorteioDados, key=itemgetter(1), reverse=True) \ No newline at end of file diff --git a/exerc092.py b/exerc092.py new file mode 100644 index 0000000..0fed152 --- /dev/null +++ b/exerc092.py @@ -0,0 +1,26 @@ +from datetime import date +def nomeExercicio(titulo): + print('-==-'*50) + print(f'{"":^60} {titulo}') + print('-==-'*50) +nomeExercicio('EXERCÍCIO 92 - Cadastro de trabalhador ') + +pessoa = {} +while True: + pessoa["nome"] = str(input('Nome: ')).upper().strip() + pessoa["nasc"] =int(input('Ano de Nascimento: ')) + pessoa["idade"] = date.today().year - pessoa["nasc"] + pessoa["cpts"] = int(input('Carteira de Trabalho (0 não tem): ')) + if pessoa["cpts"]==0: + break + pessoa["contratacao"] = int(input('Ano de Contratação: ')) + pessoa["salario"] = float(input('Salário: R$')) + pessoa["aposentadoria"] =(40 - (date.today().year - pessoa["contratacao"] )) + date.today().year + pessoa["aposentado"] =pessoa["aposentadoria"]-pessoa["nasc"] + + break +print('-==-' * 50) +for k,v in pessoa.items(): + print(f"O campo: {k} tem o valor: {v}") +print() +print(pessoa) diff --git a/exerc093.py b/exerc093.py new file mode 100644 index 0000000..7b1d900 --- /dev/null +++ b/exerc093.py @@ -0,0 +1,45 @@ +def nomeExercicio(titulo): + print('-==-'*50) + print(f'{"":^60} {titulo}') + print('-==-'*50) +nomeExercicio('EXERCÍCIO 93 - APROVEITAMENTO JOGADOR DE FUTEBOL') +artilheiros = [] +desempenho = {} +aproveitamento =[] +gols_feito = [] +while True: + desempenho = {} + gols_feito = [] + desempenho["nome"]= str(input('Jogador: ')).upper().strip() + + p = int(input('Partidas que jogou: ')) + desempenho["partidas"] = p + aproveitamento.append(desempenho) + + for j in range(1,p+1): + gols = int(input(f'Gols na {j}ª partida: ')) + gols_feito.append({"partida":j,"gols":gols}) + desempenho["gols"] = gols_feito + + artilheiros.append(desempenho.copy()) + print() + r = str(input('DESEJA CONTINUAR? [S/N]')).upper().strip()[0] + if r in 'Nn': + break +print() +# print(f"{artilheiros[0]}") +# print() +# print(f"{artilheiros[1]}") +# print() +jog = [] +for j in range(0,len(artilheiros)): + golz =artilheiros[j]['gols'] + totGols=0 + for g in range (0,len(golz)): + totGols=totGols+golz[g]['gols'] + jog.append({"jogador":artilheiros[j]['nome'],"partidas":artilheiros[j]['partidas'],"gols": totGols,"aproveitamento":totGols/artilheiros[j]['partidas']}) + print(f'Jogador: {artilheiros[j]["nome"]} - realizou {artilheiros[j]["partidas"]} partidas e marcou: {totGols} gols. COM UM APROVEITAMENTO {totGols/artilheiros[j]["partidas"]} gols por partida.') + +#print(jog) + +#https://www.alura.com.br/artigos/trabalhando-com-o-dicionario-no-python \ No newline at end of file diff --git a/exerc094.py b/exerc094.py new file mode 100644 index 0000000..7e1a2ff --- /dev/null +++ b/exerc094.py @@ -0,0 +1,42 @@ +print('-==-'*50) +print('EXERCÍCIO 94 - UNINDO DICIONÁRIOS E LISTAS') +print('-==-'*50) + +pessoas=[] +pessoa={} +soma_idade=0 +mulheres = [] +pessoas_velhas = [] +while True: + pessoa["nome"] = str(input('Nome: ')).upper().strip() + pessoa["idade"] = int(input('Idade: ')) + pessoa["sexo"]= str(input('sexo: ')).upper().strip()[0] + pessoas.append(pessoa) + if pessoa["sexo"] in 'Ff': + mulheres.append(pessoa) + soma_idade = soma_idade + pessoa["idade"] + r = str(input('DESEJA CONTINUAR? [S/N]')).upper().strip()[0] + if r in 'Nn': + break + pessoa={} +media_idade = soma_idade/len(pessoas) +print(f"Foram cadastradas {len(pessoas)} pessoas no sistema") +print(f"A média de idade é: {media_idade} anos entre as pessoas no sistema") +#print(pessoas) +if len(mulheres)>0: + print("As mulheres cadastradas no sistema são: ") + for key, m in enumerate(mulheres): + print(f"{m['nome']}",end=' ') +else: + print("Não foi cadastrado MULHERES no sistema") + +for k,p in enumerate(pessoas): + #print(k,p) + if(p['idade']> media_idade): + pessoas_velhas.append(p) +print() +if len(pessoas_velhas)>0: + print(pessoas_velhas) +else: + print("Não Tem Pessoas Com mais Idade que a média") + diff --git a/exerc095.py b/exerc095.py new file mode 100644 index 0000000..21b01cd --- /dev/null +++ b/exerc095.py @@ -0,0 +1,61 @@ +def nomeExercicio(titulo): + print('-==-'*50) + print(f'{"":^60} {titulo}') + print('-==-'*50) +nomeExercicio('EXERCÍCIO 95 - DESEMPENHO DO JOGADORES') + +artilheiros = [] +desempenho = {} +aproveitamento =[] +gols_feito = [] +while True: + desempenho = {} + gols_feito = [] + desempenho["nome"]= str(input('Jogador: ')).upper().strip() + p = int(input('Partidas que jogou: ')) + desempenho["partidas"] = p + aproveitamento.append(desempenho) + + for j in range(1,p+1): + gols = int(input(f'Gols na {j}ª partida: ')) + gols_feito.append({"partida":j,"gols":gols}) + desempenho["gols"] = gols_feito + + artilheiros.append(desempenho.copy()) + print() + r = str(input('DESEJA CONTINUAR? [S/N]')).upper().strip()[0] + if r in 'Nn': + break + else: + print('--' * 50) + +print() + +jog = [] +for j in range(0,len(artilheiros)): + golz =artilheiros[j]['gols'] + totGols=0 + for g in range (0,len(golz)): + totGols=totGols+golz[g]['gols'] + jog.append({"jogador":artilheiros[j]['nome'],"partidas":artilheiros[j]['partidas'],"gols": totGols,"aproveitamento":totGols/artilheiros[j]['partidas']}) + print(f'Jogador: {artilheiros[j]["nome"]} - realizou {artilheiros[j]["partidas"]} partidas e marcou: {totGols} gols. COM UM APROVEITAMENTO {totGols/artilheiros[j]["partidas"]} gols por partida.') + +print('LEVANTAMENTO') +print(artilheiros) +print("Código JOGADOR GOLS | TOTAL | APROVEITAMENTO") +x = 1 +for a in artilheiros: + gz =[] + for g in range (0,len(a['gols'])): + gz.append(a['gols'][g]['gols']) + #print(f'{x} {"":>7}{a["nome"]}{"":>5}{gz}{"":>5}{totGols}') + print(f'{x} {a["nome"]:^15} {gz} {sum(gz)} {sum(gz)/len(gz)}') + x = x+1 + +while True: + tam = len(artilheiros) + cod = int(input("Mostrar dados de qual jogador?: ")) + if cod<0 or cod > tam: + break + print("-- LEVANTAMENTO DO JOGADOR ") + print(artilheiros[cod-1]) diff --git a/exerc096.py b/exerc096.py new file mode 100644 index 0000000..dfa2c1b --- /dev/null +++ b/exerc096.py @@ -0,0 +1,10 @@ +def nomeExercicio(titulo): + print('-==-'*50) + print(f'{"":^60} {titulo}') + print('-==-'*50) +nomeExercicio('EXERCÍCIO 95 - ') + +def breakLoop(): + r = str(input('DESEJA CONTINUAR? [S/N]')).upper().strip()[0] + if r in 'Nn': + break \ No newline at end of file diff --git a/exerc097.py b/exerc097.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc098.py b/exerc098.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc099.py b/exerc099.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc100.py b/exerc100.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc101.py b/exerc101.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc102.py b/exerc102.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc103.py b/exerc103.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc104.py b/exerc104.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc105.py b/exerc105.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc106.py b/exerc106.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc107.py b/exerc107.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc108.py b/exerc108.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc109.py b/exerc109.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc110.py b/exerc110.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc111.py b/exerc111.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc112.py b/exerc112.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc113.py b/exerc113.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc114.py b/exerc114.py new file mode 100644 index 0000000..e69de29 diff --git a/exerc115.py b/exerc115.py new file mode 100644 index 0000000..e69de29 diff --git a/mp3/About_That_Oldie.mp3 b/mp3/About_That_Oldie.mp3 new file mode 100644 index 0000000..e87751c Binary files /dev/null and b/mp3/About_That_Oldie.mp3 differ diff --git a/mp3/African_Drums_Sting.mp3 b/mp3/African_Drums_Sting.mp3 new file mode 100644 index 0000000..23af1cc Binary files /dev/null and b/mp3/African_Drums_Sting.mp3 differ diff --git a/mp3/At_Rest_Romance.mp3 b/mp3/At_Rest_Romance.mp3 new file mode 100644 index 0000000..523224f Binary files /dev/null and b/mp3/At_Rest_Romance.mp3 differ diff --git a/mp3/Birds_in_Flight.mp3 b/mp3/Birds_in_Flight.mp3 new file mode 100644 index 0000000..a47b8b9 Binary files /dev/null and b/mp3/Birds_in_Flight.mp3 differ diff --git a/mp3/Bongo_Madness.mp3 b/mp3/Bongo_Madness.mp3 new file mode 100644 index 0000000..11fe750 Binary files /dev/null and b/mp3/Bongo_Madness.mp3 differ diff --git a/mp3/Bubblegum_Ballgame.mp3 b/mp3/Bubblegum_Ballgame.mp3 new file mode 100644 index 0000000..7950f9d Binary files /dev/null and b/mp3/Bubblegum_Ballgame.mp3 differ diff --git a/mp3/Casey_Dont_You_Fret.mp3 b/mp3/Casey_Dont_You_Fret.mp3 new file mode 100644 index 0000000..2980365 Binary files /dev/null and b/mp3/Casey_Dont_You_Fret.mp3 differ diff --git a/mp3/Clover_3.mp3 b/mp3/Clover_3.mp3 new file mode 100644 index 0000000..be7fdfc Binary files /dev/null and b/mp3/Clover_3.mp3 differ diff --git a/mp3/Firefly.mp3 b/mp3/Firefly.mp3 new file mode 100644 index 0000000..0e03b73 Binary files /dev/null and b/mp3/Firefly.mp3 differ diff --git a/mp3/Giant.mp3 b/mp3/Giant.mp3 new file mode 100644 index 0000000..ac8c2a1 Binary files /dev/null and b/mp3/Giant.mp3 differ diff --git a/mp3/Grasshopper.mp3 b/mp3/Grasshopper.mp3 new file mode 100644 index 0000000..51bcf93 Binary files /dev/null and b/mp3/Grasshopper.mp3 differ diff --git a/mp3/Happy_Boy_Theme.mp3 b/mp3/Happy_Boy_Theme.mp3 new file mode 100644 index 0000000..1d2e690 Binary files /dev/null and b/mp3/Happy_Boy_Theme.mp3 differ diff --git a/mp3/Happy_Little_Elves.mp3 b/mp3/Happy_Little_Elves.mp3 new file mode 100644 index 0000000..751f568 Binary files /dev/null and b/mp3/Happy_Little_Elves.mp3 differ diff --git a/mp3/Happy_Mandolin.mp3 b/mp3/Happy_Mandolin.mp3 new file mode 100644 index 0000000..8f4654f Binary files /dev/null and b/mp3/Happy_Mandolin.mp3 differ diff --git a/mp3/If_I_Had_a_Chicken.mp3 b/mp3/If_I_Had_a_Chicken.mp3 new file mode 100644 index 0000000..f8cce4e Binary files /dev/null and b/mp3/If_I_Had_a_Chicken.mp3 differ diff --git a/mp3/Invincible.mp3 b/mp3/Invincible.mp3 new file mode 100644 index 0000000..a46b01e Binary files /dev/null and b/mp3/Invincible.mp3 differ diff --git a/mp3/Last_Train_to_Mars.mp3 b/mp3/Last_Train_to_Mars.mp3 new file mode 100644 index 0000000..ae2e4c6 Binary files /dev/null and b/mp3/Last_Train_to_Mars.mp3 differ diff --git a/mp3/New_Land.mp3 b/mp3/New_Land.mp3 new file mode 100644 index 0000000..9635f02 Binary files /dev/null and b/mp3/New_Land.mp3 differ diff --git a/mp3/Noel.mp3 b/mp3/Noel.mp3 new file mode 100644 index 0000000..37953ff Binary files /dev/null and b/mp3/Noel.mp3 differ diff --git a/mp3/Path_to_Follow.mp3 b/mp3/Path_to_Follow.mp3 new file mode 100644 index 0000000..243d3a6 Binary files /dev/null and b/mp3/Path_to_Follow.mp3 differ diff --git a/mp3/Rize_Up.mp3 b/mp3/Rize_Up.mp3 new file mode 100644 index 0000000..a977cb2 Binary files /dev/null and b/mp3/Rize_Up.mp3 differ diff --git a/mp3/Scratch_the_Itch.mp3 b/mp3/Scratch_the_Itch.mp3 new file mode 100644 index 0000000..381f243 Binary files /dev/null and b/mp3/Scratch_the_Itch.mp3 differ diff --git a/mp3/Sharp_Senses.mp3 b/mp3/Sharp_Senses.mp3 new file mode 100644 index 0000000..3633d13 Binary files /dev/null and b/mp3/Sharp_Senses.mp3 differ diff --git a/mp3/Sugar_Zone.mp3 b/mp3/Sugar_Zone.mp3 new file mode 100644 index 0000000..571e862 Binary files /dev/null and b/mp3/Sugar_Zone.mp3 differ diff --git a/mp3/Valley_Drive.mp3 b/mp3/Valley_Drive.mp3 new file mode 100644 index 0000000..3a73313 Binary files /dev/null and b/mp3/Valley_Drive.mp3 differ diff --git a/mp3/Yeah_Yeah.mp3 b/mp3/Yeah_Yeah.mp3 new file mode 100644 index 0000000..78d95a3 Binary files /dev/null and b/mp3/Yeah_Yeah.mp3 differ diff --git a/mp3/alien.flv b/mp3/alien.flv new file mode 100644 index 0000000..79d663d --- /dev/null +++ b/mp3/alien.flv @@ -0,0 +1,9 @@ + + +404 Not Found + +

Not Found

+

The requested URL /gallery/alien.flv was not found on this server.

+

Additionally, a 404 Not Found +error was encountered while trying to use an ErrorDocument to handle the request.

+ diff --git a/precedencia.PNG b/precedencia.PNG new file mode 100644 index 0000000..ff9c346 Binary files /dev/null and b/precedencia.PNG differ diff --git a/questao.py b/questao.py new file mode 100644 index 0000000..2305f07 --- /dev/null +++ b/questao.py @@ -0,0 +1,6 @@ +print('Quantas palavras de comprimento 6 podemos formar com as letras a,b,c,d, de modo que cada uma das letras apareça pelo menos uma vez e que a letra "a" apareça exatamente uma vez.') + +letras = ['A','B','C','D'] + +repete = ['B','C','D'] +