-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathif.py
More file actions
43 lines (30 loc) · 902 Bytes
/
Copy pathif.py
File metadata and controls
43 lines (30 loc) · 902 Bytes
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
x = 38
print('дратути!')
if x < 0:
print('Меньше нуля')
print('дотвидания!')
# примеры
a, b = 10, 5
if a > b:
print('a > b')
if a > b and a > 0:
print('успех')
if (a > b) and (a > 0 or b < 1000):
print('успех')
if 5 < b and b < 10:
print('успех')
# можно сравнивать - числа, строки, списки, вообще -
if '34' > '123':
print('успех')
if '123' > '12':
print('успех')
if [1, 2] > [1, 1]:
print('успех')
# что нельзя сравнивать - разные типы
# if '6' > 5: # TypeError: '>' not supported between instances of 'str' and 'int'
# print('успех')
# if [5, 6] > 5: # TypeError: '>' not supported between instances of 'list' and 'int'
# print('успех')
# но
if '6' != 5:
print('успех')