forked from mouredev/Hello-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01_variables.py
46 lines (35 loc) · 1.09 KB
/
01_variables.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
# Clase 1 (03/08/22) en directo desde Twitch: https://www.twitch.tv/videos/1551265068
### Variables ###
my_string_variable = "My String variable"
print(my_string_variable)
my_int_variable = 5
print(my_int_variable)
my_int_to_str_variable = str(my_int_variable)
print(my_int_to_str_variable)
print(type(my_int_to_str_variable))
my_bool_variable = False
print(my_bool_variable)
# Concatenación de variables en un print
print(my_string_variable, my_int_to_str_variable, my_bool_variable)
print("Este es el valor de:", my_bool_variable)
# Algunas funciones del sistema
print(len(my_string_variable))
# Variables en una sola línea. ¡Cuidado con abusar de esta sintaxis!
name, surname, alias, age = "Brais", "Moure", 'MoureDev', 35
print("Me llamo:", name, surname, ". Mi edad es:", age, ". Y mi alias es:", alias)
# Inputs
name = input('¿Cuál es tu nombre? ')
age = input('¿Cuántos años tienes? ')
print(name)
print(age)
# Cambiamos su tipo
name = 35
age = "Brais"
print(name)
print(age)
# ¿Forzamos el tipo?
address: str = "Mi dirección"
address = True
address = 5
address = 1.2
print(type(address))