forked from cahdelaoadmin/Python.Desde.Cero
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01_variables.py
More file actions
48 lines (36 loc) · 1.09 KB
/
01_variables.py
File metadata and controls
48 lines (36 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
# Variables en Python
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
print(my_string_variable, my_int_variable, my_bool_variable)
print(type(print("My cadena de texto"))) # Tipo Non type
print(my_string_variable,my_int_to_str_variable,my_bool_variable)
print("Este es el valor de:",my_bool_variable)
# Funciones del sistema
print(len(my_string_variable))
# Variables en una sola línea. ¡Cuidado con abusar de esta sintaxis!
name, surname, alias, age = "Carlos", "Hernández", "Charlie", 51
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 = "Charlie"
print(name)
print(age)
# Frozamos el tipo
address: str = "Mi dirección"
address = 32
print(type(address))