-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02_operators.py
More file actions
46 lines (35 loc) · 1.06 KB
/
02_operators.py
File metadata and controls
46 lines (35 loc) · 1.06 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
#Operadores
print(3 + 4)
print(3 - 4)
print(3 * 4)
print(3 / 4)
print(3 % 4)
print(3 // 4)
print(2 ** 3)
print("Hola" + " Python")
#Operadores comparativos con int
print(4 < 3)
print(4 > 3)
print(5 <= 3)
print(5 >= 3)
print(6 == 7)
print(6 != 7)
#Operadores comparativos con str
print("Hola" < " Python")
print("Hola" > " Python")
print("Hola" <= " Python")
print("Hola" >= " Python")
print("Hola" == " Python")
print("Hola" != " Python")
#Operadores lógicos
# and: Devuelve True si ambos operandos son True
print(3 > 4 and "Hola" > "Python") #---> False and False = False
print(3 < 4 and "Hola" < "Python") #---> True and True = True
print(3 < 4 and "Hola" > "Python") #---> True and False = False
# or: Devuelve True si alguno de los operandos es True
print(3 > 4 or "Hola" < "Python") #---> False or True = True
print(3 > 4 and "Hola" > "Python") #---> False and False = False
print(3 < 4 and "Hola" < "Python") #---> True and True = True
# not: Devuelve True si alguno de los operandos es False
print(not(3 > 4)) #---> False = True
print(not(3 < 4)) #---> True = False