This week I'm back to Python basics revising, building, and going deeper than tutorials usually take you. And honestly? Revisiting fundamentals hits different when you're actually building projects alongside them. Here are 4 Python things that surprised me (and most devs never know): 01 -> for loops have an else block It runs only if no break was hit. No need for a found = False flag ever again. 02 -> Dicts are ordered since Python 3.7 People still use OrderedDict out of habit. You haven't needed it for years. 03 -> _ stores your last REPL result Type 42 * 1000, then _ / 100 — it chains. The underscore is alive in the REPL. 04 -> zip() silently drops extra items If your two lists are different lengths, regular zip loses data without a warning. Use itertools.zip_longest with a fillvalue. The best way to remember tricks is to build something with them immediately. What Python thing surprised you when you first discovered it? Drop it below 👇 #Python #100DaysOfCode #Programming #SoftwareDevelopment #OpenToWork
4 Python Surprises for Devs
More Relevant Posts
-
Day 1 of sharing my Python learning journey 🚀 Today, I want to start with the foundation of Python — understanding Lists, Tuples, Sets, and Dictionaries. These are some of the most important data structures in Python, and knowing when to use each one makes problem-solving much easier. 🔹 List → Ordered, mutable, allows duplicate values Example: [1, 2, 3, 4] 🔹 Tuple → Ordered, immutable, allows duplicates Example: (1, 2, 3, 4) 🔹 Set → Unordered, mutable, unique values only Example: {1, 2, 3, 4} 🔹 Dictionary → Key-value pair structure Example: {"name": "Harathi", "skill": "Python"} Understanding these basics helps in writing clean and efficient code. Strong fundamentals always build strong developers. I’m continuously improving my Python, Django, and backend development skills and sharing my journey here. More learning posts coming soon! #Python #Programming #BackendDeveloper #Django #SoftwareDeveloper #LearningJourney #OpenToWork #PythonDeveloper
To view or add a comment, sign in
-
🚀 Day 19 of Python Learning: Modules and Packages in Python Today I learned how to organize Python code using modules and packages — an important concept for writing scalable and maintainable programs. 🔹 What is a Module? A module is a file that contains Python code (functions, variables, or classes) which can be reused in other programs. 🔸 Example of Module file: mymodule.py def greet(): print("Hello from module") 🔸 Importing Module import mymodule mymodule.greet() 🔸 Import Specific Function from mymodule import greet greet() 🔹 What is a Package? A package is a collection of multiple modules organized in folders. It helps structure large projects. 🔸 Example Structure my_package/ init.py module1.py module2.py 💡 Key Learning: Modules help reuse code, while packages help organize large applications efficiently. 🧪 Practice Task: ✔ Create your own module with 2 functions ✔ Import and use it in another file ✔ Create a simple package with 2 modules ✔ Call functions from both modules 🎯 Interview Question: What is the difference between module and package in Python? Answer: A module is a single Python file, while a package is a collection of modules organized in directories. 📌 Day 19 completed — learning how real projects are structured! #Python #Learning #CodingJourney #Day19 #Programming #SDET #100DaysOfCode Masai #dailylearning #masaiverse
To view or add a comment, sign in
-
🚀 Just Built My First Python Project – Expense Tracker As part of my Python learning journey, I created a small console-based Expense Tracker using Python. This project allows users to record their daily expenses and view the total amount spent. While it's a simple project, it helped me understand how to use lists, dictionaries, loops, and conditionals to manage and process data. 🔹 Features of the Project: • Add daily expenses with date, category, description, and amount • View all recorded expenses • Calculate total spending • Menu-driven console interface 💡 What I Learned: • Working with lists of dictionaries • Using loops and conditional statements for program flow • Handling user input in Python • Organizing data in a simple application This is just the beginning of my journey in Python. I’m excited to keep building more projects and improving my programming skills. If you’re also learning Python, I’d love to connect and learn together! #Python #CodingJourney #Programming #LearningToCode #SoftwareDevelopment
To view or add a comment, sign in
-
Today I focused on understanding the fundamentals of Object-Oriented Programming (OOP) in Python. 📌 Key concepts I learned: 🔹 What is a Class? A class is a blueprint used to create objects. An object is an instance of a class. 🔹 Reference Variables vs Instance Variables Reference variables store the address of an object Instance variables belong to each individual object 🔹 Constructor in Python The constructor method __init__() is used to initialize object values It is automatically called when an object is created 🔹 Self Variable self refers to the current instance of the class It is used to access variables and methods inside the class 💡 These concepts are the foundation for writing structured, reusable, and efficient Python code. Consistency is the key — learning something new every day Global Quest Technologies #Python #OOP #CodingJourney #LearnPython #Programming #Developers #TechLearning #SoftwareDevelopment #PythonDeveloper #StudentDeveloper #GlobalQuestTechnologies
To view or add a comment, sign in
-
-
📚 Continuing my Python learning journey Today I focused on understanding lists in Python and explored their features, functions, and practical usage. Key concepts I learned and practiced: ----------------------------------------------------------- ● List basics & features – understanding the list data type and its flexibility ● Built-in functions – using len() and the list() constructor ● Creating lists – from strings, tuples, range(), and creating empty lists ● Type validation – using type() to check data types ●Accessing elements – using index, negative indexing, and slicing (range of indexes) ● Checking existence – verifying if an item exists in a list ● Modifying lists – changing single and multiple items ● Replacing items – updating with more or fewer elements ● Inserting items – adding elements without replacing existing ones using insert() Understanding how flexible lists are makes it clear why they are one of the most widely used data structures in Python. Step by step, I’m building a stronger foundation in Python programming and problem-solving. 🚀 #Python #Programming #LearningJourney #ComputerScience #Coding
To view or add a comment, sign in
-
🚀 Found an Amazing GitHub Repo to Learn Python While exploring GitHub, I came across this resource: https://lnkd.in/g6wRtmqM And honestly, it’s one of the most structured ways to learn Python. What makes it useful: - Step-by-step learning (Day 1 → Day 30) - Covers basics to advanced concepts - Includes real examples + exercises - Self-paced (you can go beyond 30 days) What you’ll learn: - Core fundamentals (variables, loops, functions) - Data structures (lists, dictionaries, sets) - Advanced topics (OOP, APIs, web, databases) All in a single structured roadmap. Why I like it: Instead of jumping between random tutorials… this gives a clear path to follow. Final thought: Sometimes the best resources are not courses… they’re hidden in open-source. If you're learning Python, this is worth checking out. Follow Saif Modan #Python #Learning #GitHub #Coding #Developers
To view or add a comment, sign in
-
-
10 Python Built-in Functions You Should Know: If you’re learning Python or writing code daily, these built-in functions will save you time and make your code cleaner: 🔹 len() → Count items in a list or string. 🔹 zip() → Combine two lists into pairs. 🔹 map() → Apply a function to every item. 🔹 filter() → Filter items based on a condition. 🔹 any() → Returns True if any item is True. 🔹 all() → Returns True if all items are True. 🔹 sum() → Adds up elements in an iterable. 🔹 sorted() → Sorts items. 🔹 enumerate() → Adds index to items. 🔹 range() → Generates a sequence of numbers. Mastering these small functions is very helpful in writing clean code. Which one do you use the most? #Python #Programming #Developers #Coding #SoftwareEngineering #CodingInterview #PythonDeveloper
To view or add a comment, sign in
-
-
*Day 26 of my python learning journey* Today I learned about Getter, Setter, and 3 types of methods in Python OOP. *Getter & Setter methods:* Getters are used to access private data safely → `get_name()` Setters are used to update private data with validation → `set_age()` They help protect data and add control over how variables are read or changed. *3 Types of Methods in Python:* 1. *Instance method* → Uses `self`, works with object data. Called by objects. 2. *Class method* → Uses `@classmethod` and `cls`, works with class variables. Called by class. 3. *Static method* → Uses `@staticmethod`, doesn’t use `self` or `cls`. Like a normal function inside class. One more step toward writing clean, secure OOP code. Special thanks to the CEO G.R NARENDRA REDDY Sir for constant guidance and motivation. #Python #OOP #GetterSetter #LearningJourney #Programming
To view or add a comment, sign in
-
Explore related topics
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