Last active
June 11, 2017 06:02
-
-
Save alan-morais/c966750095f7e640022d1cf2552d1889 to your computer and use it in GitHub Desktop.
Aulas de Python3 Curso em Vídeo http://www.cursoemvideo.com/
This file contains hidden or 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
print('Olá, Mundo') | |
msg = 'Olá, Mundo' | |
print(msg) |
This file contains hidden or 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
nome = input('Qual o seu nome? :') | |
print('Muito prazer em conhece-lo,', nome, '!') # formatoantigo | |
print('Muito prazer em conhece-lo, {}!'.format(nome)) |
This file contains hidden or 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
n1 = int(input('Digite um número:')) | |
n2 = int(input('Digite outro número: ')) | |
s = n1 + n2 | |
print('A soma entre {} e {} é igual a {}'.format(n1, n2, s)) |
This file contains hidden or 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 = input('Digite algo: ') | |
print('O tipo primitivo é: ', type(a)) | |
print('Só tem espaço?', a.isspace()) | |
print('É um número? ', a.isnumeric()) | |
print('É alfabetico?', a.isalpha()) | |
print('É alfanumerico?', a.isalnum()) | |
print('Está em maiusula?', a.isupper()) | |
print('Está em minuscula?', a.islower()) | |
print('Está capitalizada', a.istitle()) |
This file contains hidden or 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
#número inteiro com anterior e sucessor | |
N = int(input('Digite um número inteiro: ')) | |
print('Anterior {}, Número {} e Sucessor {}'.format((N-1), N, (N+1))) |
This file contains hidden or 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
#número com dobro, triplo e raiz | |
N = int(input('Dígite um número: ')) | |
Do = N*2 | |
Tr = N*3 | |
Ra = N**(1/2) | |
print('Número {}, Dobro do Número {}\nTriplo do Número {} e a Raiz Quadrada {:.2f}'.format(N, Do, Tr, Ra)) |
This file contains hidden or 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
#média de aluno com 2 notas | |
N1 = float(input('Primeira nota: ')) | |
N2 = float(input('Segunda nota: ')) | |
m =(N1+N2)/2 | |
print('A nota é {} e a média é {:.2f}'.format(N1+N2, m)) |
This file contains hidden or 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
#converter M em cm e mm | |
m = float (input('Digite o número em métros: ')) | |
cm = m*100 | |
mm = m*1000 | |
print('Em metros {} em Centímetos {:.0f} e em Milímetros {:.0f}'.format(m, cm, mm)) |
This file contains hidden or 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
#tabuada | |
#t = int(input('Digite o número da tabuada: ')) | |
#for n in range(1, 11): | |
# print(t, ' X ', n, ' = {}'.format(t*n)) | |
n = int(input('Digite um número: ')) | |
print('*'*12) | |
print('{:2} x {:2} = {}'.format(1, n, n*1)) | |
print('{:2} x {:2} = {}'.format(2, n, n*2)) | |
print('{:2} x {:2} = {}'.format(3, n, n*3)) | |
print('{:2} x {:2} = {}'.format(4, n, n*4)) | |
print('{:2} x {:2} = {}'.format(5, n, n*5)) | |
print('{:2} x {:2} = {}'.format(6, n, n*6)) | |
print('{:2} x {:2} = {}'.format(7, n, n*7)) | |
print('{:2} x {:2} = {}'.format(8, n, n*8)) | |
print('{:2} x {:2} = {}'.format(9, n, n*9)) | |
print('{} x {:2} = {}'.format(10,n, n*10)) | |
print('*'*12) |
This file contains hidden or 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
#converter R$ para US$ | |
R = int(input('Quantos R$ você tem? ')) | |
print('Você pode comprar até US$ {:.3} dólares'.format(R/3.27)) |
This file contains hidden or 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
#medir m² e quantidade de tinta | |
alt = float(input('Digite a altura: ')) | |
com = float(input('Digite o comprimento: ')) | |
mq = alt*com | |
tinta = (mq/2) | |
print('Sua parede tem {} m² e você pode usar até {}l de tinta'.format(mq, tinta)) |
This file contains hidden or 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
#Desconto de 5% | |
pn = int(input('Valor normal: ')) | |
des = pn*0.05 | |
print('Preço normal R$ {} seu desconto de 5% é R$ {:.3}'.format(pn, pn*0.05)) |
This file contains hidden or 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
#15% de aumento de salário | |
sal = int(input('Digite seu salário atual: ')) | |
print('Salário atual de R${} reais vai ter um aumento de 15% \nseu novo salário será de R${} reais'.format(sal, (sal*0.15)+sal )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment