day 9
This commit is contained in:
6
day8/excersise.py
Normal file
6
day8/excersise.py
Normal file
@@ -0,0 +1,6 @@
|
||||
dog = {}
|
||||
|
||||
dog['color'] = 'white'
|
||||
dog['breed'] =
|
||||
dog['legs'] =
|
||||
dog['age'] =
|
||||
123
day9/excersises.py
Normal file
123
day9/excersises.py
Normal file
@@ -0,0 +1,123 @@
|
||||
# LVL 1
|
||||
|
||||
#EX1
|
||||
|
||||
edad = int(input("Escribe tu edad: "))
|
||||
|
||||
if (edad < 18):
|
||||
print(f"Te faltan {18 - edad} años para poder tomar")
|
||||
else:
|
||||
print(f"Ándele mi rey, puede tomar")
|
||||
|
||||
|
||||
# EX2
|
||||
|
||||
mi_edad = int(input("Escribe mi edad: "))
|
||||
tu_edad = int(input("Escribe tu edad: "))
|
||||
|
||||
if (mi_edad > tu_edad):
|
||||
print("Soy mayor que tú por", tu_edad-mi_edad, "años")
|
||||
elif (tu_edad > mi_edad):
|
||||
print("Eres mayor que yo por", tu_edad-mi_edad, "años")
|
||||
else:
|
||||
print("Tenemos la misma edad")
|
||||
|
||||
# EX3
|
||||
a = int(input("Escribe el valor de a: "))
|
||||
b = int(input("Escribe el valor de b: "))
|
||||
|
||||
if (a>b):
|
||||
print(f"{a} es mayor que {b}")
|
||||
elif (a<b):
|
||||
print(f"{a} es menor que {b}")
|
||||
else:
|
||||
print(f"{a} y {b} valen lo mismo")
|
||||
|
||||
|
||||
# LVL2
|
||||
|
||||
# EX1
|
||||
|
||||
calif = int(input("Escribe tu calificación: "))
|
||||
|
||||
if (calif < 60):
|
||||
print("F")
|
||||
elif (calif >= 60 and calif < 70):
|
||||
print("D")
|
||||
elif (calif >= 70 and calif < 80):
|
||||
print("C")
|
||||
elif (calif >= 80 and calif < 90):
|
||||
print("B")
|
||||
elif (calif >= 90 and calif <= 100):
|
||||
print("A")
|
||||
|
||||
# EX2
|
||||
|
||||
prim = ["marzo", "abril", "mayo"]
|
||||
vera = ["junio", "julio", "agosto"]
|
||||
oton = ["septiembre", "octubre", "noviembre"]
|
||||
invi = ["diciembre", "enero", "febrero"]
|
||||
|
||||
mes = input("Escribe un mes (en minúsculas): ")
|
||||
|
||||
if (mes in prim):
|
||||
print("Estás en primavera.")
|
||||
elif (mes in vera):
|
||||
print("Estás en verano.")
|
||||
elif (mes in oton):
|
||||
print("Estás en otoño.")
|
||||
elif (mes in invi):
|
||||
print("Estás en invierno.")
|
||||
else:
|
||||
print("no pusiste un mes válido")
|
||||
|
||||
|
||||
# EX3
|
||||
|
||||
fruits = ['platano', 'naranja', 'mango', 'limon']
|
||||
|
||||
fruta = input("Escribe el nombre de una fruta: ")
|
||||
|
||||
if (fruta in fruits):
|
||||
print("ya está en la lista")
|
||||
else:
|
||||
print("fruta no encontrada, añadiendo")
|
||||
fruits.append(fruta)
|
||||
print(fruits)
|
||||
|
||||
|
||||
# LVL 3
|
||||
|
||||
# EX
|
||||
|
||||
person={
|
||||
'first_name': 'Asabeneh',
|
||||
'last_name': 'Yetayeh',
|
||||
'age': 250,
|
||||
'country': 'Finland',
|
||||
'is_married': True,
|
||||
'skills': ['JavaScript', 'React', 'Node', 'MongoDB', 'Python'],
|
||||
'address': {
|
||||
'street': 'Space street',
|
||||
'zipcode': '02210'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# -
|
||||
|
||||
if ('skills' in person):
|
||||
print(person['skills'])
|
||||
if ('Python' in person['skills']):
|
||||
print(person['skills'][4])
|
||||
elif ('JavaScript' in person['skills'] and 'React' in person['skills']):
|
||||
print("Es Front")
|
||||
elif ('Python' in person['skills'] and 'Node' in person['skills'] and 'MongoDB' in person['skills']):
|
||||
print("Es Back")
|
||||
elif ('JavaScript' in person['skills'] and 'React' in person['skills'] and 'Python' in person['skills'] and 'Node' in person['skills'] and 'MongoDB' in person['skills']):
|
||||
print("Es Full")
|
||||
else:
|
||||
print("Sepa la bola qué sea")
|
||||
|
||||
if (person['is_married'] and person['country'] == 'Finland'):
|
||||
print(f"{person['first_name']} {person['last_name']} vive en {person['country']} y está felizmente casado")
|
||||
Reference in New Issue
Block a user