Created
September 25, 2017 14:46
-
-
Save nanduzz/5791c3d565f5515e33dd0bcd46e7dcce to your computer and use it in GitHub Desktop.
Primeiro dia Semana da computação UEM curso introdução a python
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
''' CADA BLOCO DE COMENTAIRO REPRESENTA UM EXERCICIO ''' | |
''' | |
ex01 | |
arquivo = raw_input('Digite o nome do arquivo: ') | |
print arquivo[:-4] | |
arquivoNovaExt = arquivo[:-4] + '.mp3' | |
print 'novo nome :' + arquivoNovaExt | |
''' | |
''' | |
#ex02 | |
nome = raw_input('digite uma stirng: ') | |
tamanho = len(string) | |
metade = tamanho / 2 | |
primeiraParte = nome[:metade].upper() | |
segundaParte = nome[metade:].lower() | |
print primeiraParte + segundaParte | |
''' | |
''' | |
palavra = raw_input('Digite uma palavra em ingles: ') | |
palavra = palavra + 'ing' | |
print 'Gerundio :' + palavra | |
''' | |
''' | |
frase = raw_input('Digite uma frase:') | |
palavras = frase.split(' ') | |
print 'tamanho da frase :' + str(len(palavras)) | |
print palavras | |
''' | |
''' | |
temperaturaE = raw_input('digite uma temperatura: ') | |
temperatura = int(temperaturaE[:-1]) | |
if temperaturaE.endswith('C') or temperaturaE.endswith('c') : | |
f = (9*temperatura + (32*5)) / 5. | |
print 'fahrenheit: ' + str(f) | |
elif temperaturaE.endswith('F') or temperaturaE.endswith('f') : | |
c = (5 * (temperatura - 32) )/ 9. | |
print 'Ceucius' + str(c) | |
else : | |
print 'Temperatura invalida' | |
''' | |
''' | |
angulo = int(raw_input('digite um angulo: ')) | |
mod = angulo % 360 | |
if mod < 90 : | |
print 'pertence ao 1 quadrante ' | |
elif mod < 180 : | |
print 'pertence ao 2 quadrante ' | |
elif mod < 270 : | |
print 'pertence ao 3 quadrante ' | |
else : | |
print 'pertence ao 4 quadrante' | |
''' | |
''' | |
print 'entre com os tres lados do triangulo:' | |
a,b,c = int(raw_input()), int(raw_input()), int(raw_input()) | |
if a > ( b + c ) or b > (a + c ) or c > ( a + b) : | |
print 'nao eh um triangulo valido' | |
else : | |
print 'ok' | |
''' | |
''' | |
lista1 = ['Joao', 'Rafael', 'Douglas'] | |
lista2 = [1,2,3] | |
lista3 = [4,5,6,7,8,9] | |
todasListas = [lista1, lista2, lista3] | |
for lista in todasListas: | |
for valor in lista: | |
if type(valor) == str and valor.startswith('J') or type(valor) == int and valor == 2: | |
print valor | |
''' | |
par = 0 | |
impar = 0 | |
for x in range(1, int(raw_input())) : | |
if x % 2 == 0 : | |
par = par + 1 | |
else : | |
impar = impar + 1 | |
print 'impares :' + str(impar) | |
print 'pares :' + str(par) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment