-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAula020.py
107 lines (74 loc) · 1.59 KB
/
Aula020.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# FUNÇÕES / FUNCTIONS #
def lin():
print('-' * 30)
lin()
print(' Curso em Video')
lin()
print(' Aprenda Python')
lin()
print(' Gustavo Guanabara')
lin()
print()
lin()
print(' Curso em Video')
print(' Aprenda Python')
print(' Gustavo Guanabara')
lin()
print()
def mensagem(msg):
print('\033[31m-\033[m' * 30)
print(msg)
print('\033[31m-\033[m' * 30)
mensagem('Sistema de alunos')
print()
def titulo(txt):
print('\033[31m▓\033[m' * 40)
print(txt)
print('\033[33m▓\033[m' * 40)
print()
print()
titulo('CURSO EM VIDEO')
titulo('APRENDA PYTHON')
titulo('GUSTAVO GUANABARA')
def soma(a, b, c):
print('\033[36m▓\033[m' * 40)
print(f' A = {a}\n B = {b}\n C = {c}')
s = a + b + c
print()
print(f'SOLUÇÃO: {a} + {b} = {s}')
print('\033[35m▓\033[m' * 40)
print()
print()
# Programa principal
soma(4, 5, 1)
soma(8, 9, 2)
soma(2, 1, 3)
soma(b=2, a=1, c=3)
soma(c=3, a=2, b=1)
def contador(*num):
for v in num:
print(f'{v} ', end='')
contador(1, 2, 3, 4, 5)
contador(6, 7, 8)
print()
def contador2(*n):
tam = len(n)
print(f'Recebi os valores{n} e são ao todo {tam} números.')
print()
contador2(1, 2, 3, 4, 5)
contador2(6, 7, 8)
def dobra(lista):
pos = 0
while pos < len(lista):
lista[pos] *= 2
pos += 1
valores = [1, 2, 3, 4, 5, 6, 7, 8, 9]
dobra(valores)
print(valores)
def soma3(* valoress):
s = 0
for nm in valoress:
s += nm
print(f'Somando os valores {valoress} temos {s}')
soma3(5, 2)
soma3(2, 4, 8)