forked from aluchici/cmi-portfolio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython-control.py
More file actions
71 lines (62 loc) · 1.09 KB
/
Copy pathpython-control.py
File metadata and controls
71 lines (62 loc) · 1.09 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
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
a = 3 + 4
b = 5 > 4
c = ((3 + 4) * (32 + 4)) > 0
d = a == b # is equal to
e = a != b # is not equal to
f = a >= b # is greater or equal
g = b <= a # is less or equal
h = not True # equivalent to False
i = not a > b
# if elif else
if a > 10: # if conditie:
a = a + 1 # a += 1
b = 10
c = 1000
elif a == 7:
a = a * 2
elif a < 3:
a = 4 * a
else:
a = a - 1 # a -= 1
print(b, c)
print(a)
# for
# c = 0
# pentru fiecare element din lista, adauga 1 la valoarea lui c
# pentru fiecare utilizator:
# daca numele == "andrei":
# numele = "andrei modificat"
# pentru fiecare numar de la 1 la 100:
# calculeaza numar * numar
l = [1, 2, 3, 4, 5, 6, 7, 8, 9]
c = 0
for element in l:
c += 1
print(c)
# while
# cat timp a > 0:
# a -= 1
# b *= 2
a = 5
b = 2
print(a, b)
while a > 0:
a -= 1
b = b * 2 # b *= 2
print(a, b)
for e1 in l:
if e1 == 2:
continue
if e1 == 3:
break
for e2 in l:
print(e1, e2, e1 * e2)
a = 6
b = 2
if a == 7:
for e in l:
print(a * e)
else:
while not False:
print(c)
break