Day 7 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to remove duplicate elements from a list while preserving the original order. Removing duplicates means keeping only the first occurrence of each element and ignoring repeated values. What the program does: • Takes a list of elements as input • Traverses the list one element at a time • Stores only unique elements in a new list • Preserves the original order of elements How the logic works: An empty list (unique_list) is created to store unique elements The program iterates through each item in the original list If the item is not already present in unique_list, it is added Duplicate elements are skipped automatically The final list containing only unique elements is returned Example: Original list: [1, 2, 2, 3, 4, 4, 5] Output: List without duplicates: [1, 2, 3, 4, 5] Key learnings from Day 7: – Understanding list traversal in Python – Preserving order while removing duplicates – Writing clean and readable functions – Strengthening basic logic-building skills #100DaysOfCode #Day7 #Python #PythonProgramming #ProblemSolving #CodingChallenge #LearningInPublic #CodeNewbie #BTech #CSE #AIandML #VITBhopal #TechJourney
Removing Duplicates from List in Python
More Relevant Posts
-
Day 9 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to find the second largest number in a list using an optimized approach. The goal was to solve the problem without sorting the list and by traversing it only once. What the program does: • Takes a list of numbers as input • Handles edge cases where a second largest element does not exist • Tracks the largest and second largest values efficiently • Returns the second largest number How the logic works: If the list contains fewer than two elements, the function returns None Two variables (first and second) are initialized with negative infinity The list is traversed one element at a time If the current number is greater than first: – second is updated with the previous first – first is updated with the current number If the number lies between first and second, second is updated After traversal, the function returns the second largest value Example: Input list: [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5] Output: Second largest number = 6 Key learnings from Day 9: – Solving problems without built-in sorting – Using conditional logic effectively – Understanding single-pass algorithms – Writing optimized Python code #100DaysOfCode #Day9 #Python #PythonProgramming #ProblemSolving #DataStructures #CodingChallenge #LearningInPublic #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
-
Day 14 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to find the common elements between two lists using sets. The goal was to solve the problem efficiently without using nested loops. What the program does: • Takes two lists as input • Converts both lists into sets • Uses set intersection to find common elements • Converts the result back into a list • Prints the common elements How the logic works: Two lists are defined with numeric values Both lists are converted into sets using set() The intersection operator & is used to find common elements The resulting set is converted back into a list The final list of common elements is displayed Example: List 1:[1, 2, 3, 4, 5] List 2:[4, 5, 6, 7, 8] Output: Common elements:[4, 5] Key learnings from Day 14: – Understanding set operations in Python – Using intersection (&) efficiently – Avoiding nested loops for better performance – Writing clean and optimized code #100DaysOfCode #Day14 #Python #PythonProgramming #SetOperations #DataStructures #ProblemSolving #CodingPractice #LearnByDoing #ComputerScience #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
-
Day 32 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to implement a custom version of the isdigit() function. Instead of using Python’s built-in method, I created my own function to check whether a string contains only numeric digits. What the program does: • Takes a string as input • Checks each character in the string • Verifies whether it lies between '0' and '9' • Returns True if all characters are digits • Returns False otherwise How the logic works: 1)The function first checks if the string is empty 2)If it is empty, it returns False 3)The program iterates through each character in the string 4)It checks whether the character falls within the range '0' to '9' 5)If any character fails this condition, the function returns False 6)If all characters satisfy the condition, the function returns True Example: Input: "123" Output: True Input: "123a" Output: False Input: "-1" Output: False Input: "0" Output: True Why this is useful: – Helps understand how built-in functions work internally – Uses ASCII character comparison – Strengthens string validation logic Key learnings from Day 32: – Implementing built-in functionality manually – Understanding ASCII-based comparisons – Writing validation logic for strings – Strengthening Python fundamentals #100DaysOfCode #Day32 #Python #PythonProgramming #StringValidation #Algorithms #ProblemSolving #CodingPractice #LearnByDoing #ComputerScience #ProgrammingJourney #DeveloperGrowth #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
-
Day 26 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to find the intersection of two arrays (lists). The goal was to identify the elements that appear in both arrays using Python’s set operations. What the program does: • Takes two lists as input • Converts the lists into sets • Finds the common elements between them • Demonstrates two ways to compute intersection • Prints the intersection result How the logic works: 1)Two lists (arr1 and arr2) are defined 2)Both lists are converted into sets using set() 3)Intersection is calculated using the .intersection() method 4)The same result is also computed using the & operator 5)The resulting set is converted back into a list and printed Example: Input: Array 1:[1, 2, 3, 4, 5] Array 2:[4, 5, 6, 7, 8] Output: Intersection:[4, 5] Why using sets is powerful: – Removes duplicate values automatically – Faster lookup operations – Time Complexity around O(n) Key learnings from Day 26: – Understanding set operations in Python – Using .intersection() vs & operator – Writing efficient list comparison logic – Strengthening data structure knowledge #100DaysOfCode #Day26 #Python #PythonProgramming #SetOperations #DataStructures #Algorithms #ProblemSolving #CodingPractice #LearnByDoing #ComputerScience #InterviewPrep #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
-
Day 17 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to count the number of vowels and consonants in a given string. The goal was to practice string traversal and character classification. What the program does: • Takes a string input from the user • Converts the string to lowercase for consistency • Checks each character individually • Counts vowels and consonants separately • Returns both counts How the logic works: A function count_vowels_consonants(string) is defined Two strings are created: – One containing all vowels (aeiou) – One containing all consonants Two counters are initialized to 0 The program loops through each character in the string If the character is in the vowel string, vowel count increases If the character is in the consonant string, consonant count increases The function returns both counts Example: Input: my name is SATISH KUMAR Output: Vowels: 7 Consonants: 12 Key learnings from Day 17: – Iterating through strings – Using conditional statements effectively – Handling case sensitivity with .lower() – Strengthening basic string manipulation skills #100DaysOfCode #Day17 #Python #PythonProgramming #StringManipulation #ProblemSolving #CodingPractice #LogicBuilding #LearnByDoing #ComputerScience #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
-
👋 Welcome back! 📅 Python Learning – Day 49 Today we explore a simple but powerful data structure: Stacks. A stack follows one main rule: Last In, First Out (LIFO). The last item you add is the first one you remove. You can think of it like a stack of books. You always pick up the top one first. 📘 In this lesson, I’ve explained: 📚 What a stack is and where it is used ➕ How to push and pop elements in Python ⚠️ Common beginner mistakes when managing stack operations Stacks are widely used in real-world programming, from undo features to expression evaluation. Once you understand stacks, many algorithm problems become easier to solve. 🔗 Tutorial link is in the comments. ⏭️ Tomorrow: Python Queues #PythonStacks #LIFOConcept #DataStructuresLearning #CodingPractice #LearnPythonStepByStep #AlgorithmBasics #PythonForStudents #TechSkillBuilding #codepractice #learnpython #python2026 #codewithconfidence #codingtutorials
To view or add a comment, sign in
-
-
👋 Welcome back! 📅 Python Learning – Day 48 Today we focus on two very important data structures: Lists and Arrays. Both store multiple values, but they are used in slightly different ways. Understanding the difference helps you choose the right tool for the right problem. 👉 Lists are flexible and commonly used. 👉 Arrays are more structured and often used for numeric operations. 📘 In this lesson, I’ve explained: 📋 How lists work and why they are widely used 📊 How arrays differ from lists ⚠️ Common beginner mistakes when selecting between them Many learners treat lists and arrays as the same. Once you understand their purpose, your code becomes more efficient and intentional. Choosing the right structure is a big step toward better problem-solving. 🔗 Tutorial link is in the comments. ⏭️ Tomorrow: Python Stacks #PythonLists #PythonArrays #DataStructuresInPython #CodingConcepts #LearnPythonDaily #ProgrammingLogic #TechStudents #DeveloperSkills #codepractice #learnpython #codingpractice #codewithconfidence
To view or add a comment, sign in
-
-
Python Journey — Day 13 | Functions with Numbers, Strings & Lists Today I continued practicing functions in Python by solving different logical problems using reusable function-based solutions. Problems I solved : • Sum of digits of a number • Product of digits • Armstrong number check • Reverse a number • Palindrome number check • Count vowels in a string • Count consonants in a string • Perfect number check • Strong number check • Find largest element in a list • Remove duplicates from a list • Reverse a list • Find second largest element • Count even and odd numbers in a list I implemented these problems using functions along with loops and list and string logic to improve code reusability and structure. Thanks to Rudra Sravan kumar sir for the guidance and continuous support. Learning daily and getting more confident #Python #PythonDeveloper #1000Coders #Coding #LearningJourney #ProblemSolving #CodeEveryDay
To view or add a comment, sign in
-
🚀 New Blog Published: Python Lists – Store Multiple Values Easily 🐍 While learning Python, I realized that storing multiple values using separate variables can quickly become messy. That’s where Lists come in. Lists allow us to store multiple pieces of data in a single variable and work with them efficiently. In my latest beginner-friendly blog, I explained: ✅ What are Python Lists ✅ How to create and access list elements ✅ Indexing and negative indexing ✅ Adding and removing items (append(), insert(), remove()) ✅ Using loops with lists ✅ Practice questions for beginners I’m documenting my Python learning journey step by step through CodingNotesHub to make concepts easier for other beginners as well. 📘 Read the full blog here: 🔗 ___________________________ (Link will be added in the comments 👇) Always learning. Always improving. 🚀 #Python #PythonForBeginners #Programming #LearningInPublic #CodingJourney #PythonLists #EngineeringStudents #CodingNotesHub
To view or add a comment, sign in
-
Python Clarity Series – Episode 19 Topic: map() vs Loop 📌 Two ways to apply a function to a list. Traditional loop: nums = [1,2,3,4] squares = [] for i in nums: squares.append(i*i) Pythonic way: nums = [1,2,3,4] squares = list(map(lambda x: x*x, nums)) 👉 map() applies a function to every element. Result: [1, 4, 9, 16] 💡 Clarity Thought: Loop → easy to understand map() → shorter and functional style Both are correct. Python gives multiple ways to solve problems. Understanding both improves coding flexibility. #PythonLearning #CodingEfficiency #FutureDevelopers
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development