Practised Python list manipulation methods to work with dynamic data efficiently. Used methods like append(), insert(), and extend() to add elements in different ways. Understood the difference between reference copy and shallow copy using copy(). Worked with pop() and remove() to delete elements by index and value. Implemented logic to remove duplicates, find item positions using index(), and frequency using count(). These exercises improved my understanding of list behavior, memory handling, and data operations. #Python #Lists #DataStructures #PythonBasics #ListMethods #LearningJourney
Mastering Python List Manipulation Techniques
More Relevant Posts
-
Not all attributes in Python should be plain data @property lets you expose a method like an attribute: compute values on access, control read/write, keep a clean API without breaking callers. Benefits: 1/ Encapsulation → hide implementation, validate on set, control access. 2/ Computed attributes → derive values on-the-fly (no stored redundant state). 3/ Backward compatibility & readability → switch a public attribute to a property without changing callers. 4/ Clear intent → callers read obj.value instead of obj.get_value() when it’s conceptually an attribute.
To view or add a comment, sign in
-
-
Simple but effective way to pack the update of an instance of a class. This is also an alternative to class builder methods. @classmethod def from_full_name(full_name: str) -> Self:
Data Engineer | Python Developer | Data Scientist | Aerospace Engineer | SQL | AWS Certified | PySpark | Scala | Git | Machine Learning | Technical Writer @Medium
Not all attributes in Python should be plain data @property lets you expose a method like an attribute: compute values on access, control read/write, keep a clean API without breaking callers. Benefits: 1/ Encapsulation → hide implementation, validate on set, control access. 2/ Computed attributes → derive values on-the-fly (no stored redundant state). 3/ Backward compatibility & readability → switch a public attribute to a property without changing callers. 4/ Clear intent → callers read obj.value instead of obj.get_value() when it’s conceptually an attribute.
To view or add a comment, sign in
-
-
Day 20/30: Automating the Mundane with Python 🤖 I’m currently on Day 20 of my 30-day Python journey, and today’s project was all about Leverage. I built a Price Tracker & Automation Bot designed to monitor multiple URLs, clean incoming data (handling those tricky encoding bugs!), and log price history to a persistent CSV file. Key Learnings: - Data Integrity: Real-world web data is messy. Robust cleaning is the difference - between a broken script and a working tool. - Scalability: Moving from single-item tracking to multi-URL loops. - Automation: Why BeautifulSoup remains a staple for rapid tool-building. Project 23 of 30 is in the books. Seven more to go! Check out the source code here: https://lnkd.in/d3NmAchr #Python #SoftwareEngineering #Automation #WebScraping #BuildInPublic #LearningToCode
To view or add a comment, sign in
-
When I first learned Python data types, I kept mixing them up. Lists, Dictionaries, Tuples, Strings. they all looked similar to me . My biggest confusion? Why couldn't I modify a Tuple after creating it, but I could modify a List? Then I learned about Mutable vs Immutable. Lists [ ] ➡️ Can add/remove/change items Dictionaries { } ➡️ Store labeled data(name, age, city) Tuples ( ) ➡️ Data that never changes Strings " " ➡️ Text that can't be modified The turning point? Practicing with real examples in VS Code instead of just reading theory. Did you also mix up Tuples and Lists when you started? Or was it just me? #Python #LearnToCode #DataTypes #PythonProgramming #CodingBasics
To view or add a comment, sign in
-
LeetCode Progress | 242. Valid Anagram (Python) Today I solved “Valid Anagram” on LeetCode. Problem: Given two strings s and t, return True if t is an anagram of s, otherwise return False. My approach: I compared character frequencies between the two strings. -- Created a set of characters from the longer string -- For each character, compared its count in both strings -- If any frequency differed, returned False Optimal approach: A more efficient solution uses frequency counting. -- Use a hash map (dictionary) or fixed-size array (26 characters) -- Increment counts for s and decrement for t -- If all counts are zero, the strings are anagrams This avoids repeated count() calls and improves performance. Follow-up (Unicode characters): -- A dictionary-based frequency counter works well for Unicode -- Arrays are less suitable because the character set is not fixed What I learned: -- Repeated counting inside loops increases time complexity -- Choosing the right data structure can significantly improve efficiency -- Frequency-based problems often have cleaner linear-time solutions #leetcode #python #dsa #datastructures #algorithms #coding #programming #problemSolving #softwareengineering #computerscience #interviewprep #codinginterview #100daysofcode #pythonprogramming
To view or add a comment, sign in
-
-
1) Create a program to check if a given number is even or odd. # Problem Statement: Create a program to check if a given number is even or odd. # Simple Python Program: # get user input num = int(input("Enter a number: ")) # check if number is even or odd if num % 2 == 0: print(num, "is an even number") else: print(num, "is an odd number") # Explanation: # First, we prompt the user to enter a number using the input() function and store it in the variable "num". Then, we use the modulus operator (%) to check if the number is divisible by 2 or not. If the remainder is 0, then the number is even, otherwise it is odd. Finally, we print the appropriate message based on the condition. # Sample Input and Output: # Enter a number: 7 # 7 is an odd number
To view or add a comment, sign in
-
Excel is excellent for quick exploration. But it struggles when analysis needs to scale. Python, especially pandas, fills that gap. Excel starts to break when: 🔹 Data grows beyond comfortable row limits 🔹 The same report must be refreshed every week 🔹 Manual steps are repeated again and again 🔹 Small formula changes create silent errors This is where Python helps. With Python, you: 🔹 Define transformation logic once 🔹 Apply the same rules to new data every time 🔹 Automate repetitive calculations 🔹 Reduce dependency on manual intervention Instead of fixing files, you maintain logic. Instead of reworking steps, you reuse them. Python does not replace Excel. It replaces repeated manual effort. That shift turns analysis into a reliable process, not a fragile file. #Python #Pandas #DataAnalysis #Analytics #Automation
To view or add a comment, sign in
-
-
💻 Python Snippet: Character Frequency Counter Just finished writing a Python script to calculate the frequency of characters in a string using a Dictionary. This simple exercise is great for solidifying concepts regarding loops, conditional statements, and key-value pair assignments. It’s a small step, but these logic blocks are the building blocks of larger Data Analysis projects. Check out the code below! #PythonDeveloper #CodingLife #Tech #SoftwareEngineering #DataAnalytics #Python name = input("Enter Fruit Name") feq = {} for i in name: #Check for if i not in feq: feq[i]=1 #if Present increasing feq else: feq[i] += 1 #print(feq) for i in feq: print(f"{i} occurs for {feq[i]} Times")
To view or add a comment, sign in
-
-
Module: Python Fundamentals Class: 09 Topic: Python Fundamentals- Variables, Data Types, Methods, Dataframe, Google Colab ▪️Knowing about Python and Google Colab ▪️Google Colab UI Tour ▪️Variable; Variable Assignment and Naming Convention ▪️Python Data Types: Numeric, String, Boolean, List, Tuple, Set, None ▪️Dictionary and Pandas Dataframe ▪️Knowing different Methods ▪️List vs. Tuples ▪️Conditionals and Order of Execution; Indentation #python #machinelearning #ML #DataScience
To view or add a comment, sign in
-
-
Sorting is not just about order — it’s about control over data 🔧 Today’s Python 🐍 practice revolved around ordering and sorting data across multiple structures. From simple integer lists to student records and dictionaries, the focus was on understanding how sorting behaves, not just applying it. I worked with both in-place sorting and non-destructive sorting to see how data mutates (or doesn’t). This extended naturally into sorting tuples and dictionaries using custom keys, a pattern that shows up everywhere — rankings, scoreboards, reports, and backend logic. Once you understand how to sort by intent instead of default behavior, the code becomes far more expressive and reliable. Small operations like sorting often decide whether data is usable or misleading. Getting this right early pays off later. #Python #Sorting #DataHandling #ProgrammingLogic #SoftwareDevelopment
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