forked from mouredev/Hello-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path08_conditionals.py
More file actions
36 lines (23 loc) · 822 Bytes
/
08_conditionals.py
File metadata and controls
36 lines (23 loc) · 822 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
# Clase 5 (31/08/22) en directo desde Twitch: https://www.twitch.tv/videos/1578036618
### Conditionals ###
# if
my_condition = False
if my_condition: # Es lo mismo que if my_condition == True:
print("Se ejecuta la condición del if")
my_condition = 5 * 5
if my_condition == 10:
print("Se ejecuta la condición del segundo if")
# if, elif, else
if my_condition > 10 and my_condition < 20:
print("Es mayor que 10 y menor que 20")
elif my_condition == 25:
print("Es igual a 25")
else:
print("Es menor o igual que 10 o mayor o igual que 20 o distinto de 25")
print("La ejecución continúa")
# Condicional con ispección de valor
my_string = ""
if not my_string:
print("Mi cadena de texto es vacía")
if my_string == "Mi cadena de textoooooo":
print("Estas cadenas de texto coinciden")