forked from ELC/python-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeme_test.py
More file actions
34 lines (26 loc) · 770 Bytes
/
Copy paththeme_test.py
File metadata and controls
34 lines (26 loc) · 770 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
una_variable = 100
hex(10)
int("0xa", 16)
def dividir(x, y): # Comentario
return x / y
if una_variable % 2 == 0:
print("El valor es par")
elif una_variable < 0:
print("El valor es impar y negativo")
elif una_variable > 100:
print("El valor es impar y mayor a 100")
else:
print("El valor no cumple las condiciones")
nombres = ["Juan", "Pedro", "Maria"]
edades = [60, 15, 84]
for nombre, edad in zip(nombres, edades): # Zip combina listas
print(f"{nombre} tiene {edad} años")
class Rectangulo:
def __init__(self, base: float, altura: float) -> None:
self.base: float = base
self.altura: float = altura
def area(self) -> float:
return self.base * self.altura
rec = Rectangulo(10, 10)
rec.base
rec.area()