|
7 | 7 | user = input("➡️ Did you complete your tasks today? (yes/no): ").lower().strip() |
8 | 8 |
|
9 | 9 | if user in ["yes", "yeah", "yep"]: |
| 10 | + while True: |
| 11 | + count = input("📝 How many tasks were in your list? ").strip() |
10 | 12 |
|
11 | | - count = input("📝 How many tasks were in your list? ").strip() |
| 13 | + if not count.isdigit() or int(count) <= 0: |
| 14 | + print("⚠️ Please enter a valid number.\n") |
| 15 | + continue |
12 | 16 |
|
13 | | - if not count.isdigit() or int(count) <= 0: |
14 | | - print("⚠️ Please enter a valid number.\n") |
15 | | - continue |
| 17 | + count = int(count) |
| 18 | + tasks = [] |
| 19 | + for i in range(count): |
16 | 20 |
|
17 | | - count = int(count) |
18 | | - tasks = [] |
19 | | - for i in range(count): |
20 | | - task = input(f" Task {i+1}: ") |
21 | | - tasks.append(task) |
| 21 | + while True: |
| 22 | + task = input(f" Task {i+1}: ").strip() |
22 | 23 |
|
23 | | - done = input("✅ How many did you complete? ").strip() |
| 24 | + if not task: |
| 25 | + print("⚠️ Task name cannot be empty.") |
| 26 | + continue |
24 | 27 |
|
25 | | - if not done.isdigit(): |
26 | | - print("⚠️ Please enter a valid number.\n") |
27 | | - continue |
| 28 | + tasks.append(task) |
| 29 | + break |
| 30 | + |
| 31 | + while True: |
28 | 32 |
|
29 | | - done = int(done) |
| 33 | + done = input("✅ How many did you complete? ").strip() |
30 | 34 |
|
31 | | - if done < 0 or done > count: |
32 | | - print("⚠️ That doesn't seem right. Try again.\n") |
33 | | - continue |
| 35 | + if not done.isdigit(): |
| 36 | + print("⚠️ Please enter a valid number.\n") |
| 37 | + continue |
34 | 38 |
|
35 | | - percentage = (done / count) * 100 |
36 | | - print(f"\n📊 Progress: {percentage:.1f}%") |
| 39 | + done = int(done) |
37 | 40 |
|
38 | | - pets = ["🐦", "🐧", "🦇", "🦤", "🦆", "🦅"] |
39 | | - pet = random.choice(pets) |
| 41 | + if done < 0 or done > count: |
| 42 | + print("⚠️ That doesn't seem right. Try again.\n") |
| 43 | + continue |
40 | 44 |
|
41 | | - if percentage < 50: |
42 | | - print("😔 The pet didn't hatch. Current stage: 🥚") |
43 | | - print("💡 Try completing more tasks tomorrow!\n") |
44 | | - elif percentage < 80: |
45 | | - print("🐣 Getting there! Current stage: 🐣") |
46 | | - print("💪 Almost hatched — keep going!\n") |
47 | | - else: |
48 | | - print(f"🎉 Congratulations! Your pet hatched: {pet}") |
49 | | - print("🏆 Amazing work today!\n") |
| 45 | + break |
| 46 | + |
| 47 | + percentage = (done / count) * 100 |
| 48 | + print(f"\n📊 Progress: {percentage:.1f}%") |
| 49 | + |
| 50 | + pets = ["🐦", "🐧", "🦇", "🦤", "🦆", "🦅"] |
| 51 | + pet = random.choice(pets) |
| 52 | + |
| 53 | + if percentage < 50: |
| 54 | + print("😔 The pet didn't hatch. Current stage: 🥚") |
| 55 | + print("💡 Try completing more tasks tomorrow!\n") |
| 56 | + elif percentage < 80: |
| 57 | + print("🐣 Getting there! Current stage: 🐣") |
| 58 | + print("💪 Almost hatched — keep going!\n") |
| 59 | + else: |
| 60 | + print(f"🎉 Congratulations! Your pet hatched: {pet}") |
| 61 | + print("🏆 Amazing work today!\n") |
| 62 | + |
| 63 | + break |
50 | 64 |
|
51 | 65 | elif user in ["no", "nope", "nah"]: |
52 | 66 | print("💬 No worries! Come back when you're done.\n") |
|
0 commit comments