-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaula7.py
More file actions
45 lines (35 loc) · 1.07 KB
/
aula7.py
File metadata and controls
45 lines (35 loc) · 1.07 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# ----------------------
# Operadores
# ----------------------
n1 = int(input('Digite o primeiro número: '))
n2 = int(input('Digite o segundo número: '))
# Adição e Subtração
print('\t{} + {} == {}'.format(n1,n2, n1+n2))
print('\t{} - {} == {}'.format(n1,n2, n1-n2))
# Multiplicação e Potência
print('\t{} * {} == {}'.format(n1,n2, n1*n2 ))
print('\t{} ** {} == {}'.format(n1,n2, n1**n2 ))
print('\t{} ** {} == {:.3f}'.format(n1,0.5, n1**0.5 ))
# Divisão
print('\t{} / {} == {:.3f}'.format(n1,n2, n1 / n2 ))
# Divisão Inteira
print('\t{} // {} == {}'.format(n1,n2, n1 // n2 ))
# Resto
print('\t{} % {} == {}'.format(n1,n2, n1 % n2 ))
# Repetição de strings:
print( '=' * 20)
# ----------------------
# Ordem de Precedência
# ----------------------
# 1º. ( )
# 2º. **
# 3º. * / // %
# 4º. + -
# ----------------------
# Macetes do print:
# ----------------------
# Alinhamento
print('<{:^10}>, <{:<10}>, <{:>10}>'.format('Léo', 'Léo', 'Léo'))
print('<{:=^10}>, <{:_<10}>, <{:X>10}>'.format('Léo', 'Léo', 'Léo'))
print('Oi ', end='')
print('Leo')