caissaa23 commited on
Commit
1e4b518
·
verified ·
1 Parent(s): c688ff4

Create retos_saludables.py

Browse files
Files changed (1) hide show
  1. retos_saludables.py +29 -0
retos_saludables.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ RETOS = [
2
+ {"descripcion": "Bebe 8 vasos de agua 💧", "completado": False, "puntos": 10, "insignia": "Héroe del Agua"},
3
+ {"descripcion": "Come una fruta nueva 🍎", "completado": False, "puntos": 15, "insignia": "NutriNinja"},
4
+ {"descripcion": "Camina 20 min 🚶‍♂️", "completado": False, "puntos": 20, "insignia": "Caminante Saludable"}
5
+ ]
6
+
7
+ PUNTOS_USUARIO = 0
8
+ INSIGNIAS_USUARIO = []
9
+
10
+ def mostrar_retos():
11
+ texto = "🎯 **Retos diarios:**\n\n"
12
+ for i, reto in enumerate(RETOS, 1):
13
+ estado = "✅ Completado" if reto["completado"] else "❌ Pendiente"
14
+ texto += f"{i}. {reto['descripcion']} - {estado}\n"
15
+ texto += f"\n🏅 Puntos: {PUNTOS_USUARIO}\n✨ Insignias: {', '.join(INSIGNIAS_USUARIO) if INSIGNIAS_USUARIO else 'Ninguna'}"
16
+ return texto
17
+
18
+ def completar_reto(numero):
19
+ global PUNTOS_USUARIO, INSIGNIAS_USUARIO
20
+ index = numero - 1
21
+ if 0 <= index < len(RETOS):
22
+ if not RETOS[index]["completado"]:
23
+ RETOS[index]["completado"] = True
24
+ PUNTOS_USUARIO += RETOS[index]["puntos"]
25
+ INSIGNIAS_USUARIO.append(RETOS[index]["insignia"])
26
+ return f"🎉 ¡Reto completado! Ganaste {RETOS[index]['puntos']} puntos y la insignia '{RETOS[index]['insignia']}'"
27
+ else:
28
+ return "⚠️ Este reto ya fue completado."
29
+ return "❌ Número de reto inválido."