Separate Numbers into Even and Odd Lists with Python

Day 8/30 Sometimes breaking data into smaller parts makes it much easier to understand and work with. 🔹 Problem: Separate numbers into even and odd lists 🔹 What I focused on today: Using loops and conditions together to organize data 🔹 My Thinking Process: Take a list of numbers from the user Check each number If divisible by 2 → even list Otherwise → odd list 👉 Simple condition, but very useful in data handling 🔹 Inputs I used: List of numbers 🔹 Code: numbers = list(map(int, input("Enter numbers separated by space: ").split())) even_numbers = [] odd_numbers = [] for num in numbers: if num % 2 == 0: even_numbers.append(num) else: odd_numbers.append(num) print("Even numbers:", even_numbers) print("Odd numbers:", odd_numbers) 🔹 Example: Input: 1 2 3 4 5 6 Even → [2, 4, 6] Odd → [1, 3, 5] 🔹 Key Takeaway: Breaking data into categories helps in better analysis and organization, which is a core concept in data analytics #Day8#Python #30DaysOfCode #LearningInPublic #DataAnalytics #ProblemSolving

To view or add a comment, sign in

Explore content categories