🚀 Most beginners “learn Python”… But very few actually build logic with it. Today, I focused on changing that. 📚 What I Learned Today I worked on Python fundamentals through real mini-projects instead of just reading concepts. I practiced: Loops & conditionals Lists, tuples & dictionaries User input handling Basic game logic Random module And most importantly… I combined them into working programs. 🧠 Key Concepts I Learned • Control Flow (if/else + loops) Used to control program decisions Example: checking correct/incorrect answers 👉 This is the backbone of any application logic • Data Structures (Tuples, Lists, Dictionaries) Tuples → fixed data (questions, answers) Lists → dynamic storage (user guesses, cart items) Dictionaries → key-value pairs (menu, capitals) 👉 Real-world use: storing structured app data • Dictionary Methods .get() → safe access (avoids errors) .items() → loop through key-value pairs 👉 Used in menus, APIs, and configs everywhere • User Input Handling input() + .upper() / .lower() 👉 Ensures consistent user interaction • Random Module random.choice() → random selection random.shuffle() → shuffle data 👉 Core for games, simulations, AI logic 💻 What I Built Today 1️⃣ Quiz Game Multiple questions with options Tracks user answers Calculates final score 👉 Learned how to structure logic step-by-step 2️⃣ Menu Ordering System Displays menu using dictionary User selects items Calculates total bill 👉 Real-world concept of cart systems (like e-commerce) 3️⃣ Dictionary Practice System Managed and updated key-value data Iterated through keys, values, items 👉 Foundation for backend development 4️⃣ Random Experiments Generated random numbers Simulated card shuffling 👉 Core concept behind games and probability systems ⚠️ Challenge I Faced Problem: → Managing multiple data structures together (lists + dictionaries + tuples) got confusing Solution: → Broke the problem into steps: Store data clearly Process user input Apply logic Print results 👉 This structured thinking made everything manageable 💡 Developer Insight Don’t just memorize syntax. 👉 Build small systems where multiple concepts work together Because: Real development = combining simple concepts into one working system 📈 Progress Reflection Today I moved from: “Learning Python concepts” → “Thinking like a developer” Now I can: Design simple programs Handle user input Build logic-driven applications This is real progress toward becoming a full-stack developer 🎯 Tomorrow’s Focus Start file handling (reading/writing files) Build a persistent version of the quiz (save scores) Improve logic structure 🔥 Final Thought Small projects build big skills. You don’t need 100 tutorials… You need 10 projects you truly understand. #buildinpublic #python #codingjourney #learnincode #developers #programming #100daysofcode #softwareengineering #beginners #webdevelopmen
More Relevant Posts
-
🚀 Most beginners “learn Python”… But very few actually build logic with it. Today, I focused on changing that. 📚 What I Learned Today I worked on Python fundamentals through real mini-projects instead of just reading concepts. I practiced: Loops & conditionals Lists, tuples & dictionaries User input handling Basic game logic Random module And most importantly… I combined them into working programs. 🧠 Key Concepts I Learned • Control Flow (if/else + loops) Used to control program decisions Example: checking correct/incorrect answers 👉 This is the backbone of any application logic • Data Structures (Tuples, Lists, Dictionaries) Tuples → fixed data (questions, answers) Lists → dynamic storage (user guesses, cart items) Dictionaries → key-value pairs (menu, capitals) 👉 Real-world use: storing structured app data • Dictionary Methods .get() → safe access (avoids errors) .items() → loop through key-value pairs 👉 Used in menus, APIs, and configs everywhere • User Input Handling input() + .upper() / .lower() 👉 Ensures consistent user interaction • Random Module random.choice() → random selection random.shuffle() → shuffle data 👉 Core for games, simulations, AI logic 💻 What I Built Today 1️⃣ Quiz Game Multiple questions with options Tracks user answers Calculates final score 👉 Learned how to structure logic step-by-step 2️⃣ Menu Ordering System Displays menu using dictionary User selects items Calculates total bill 👉 Real-world concept of cart systems (like e-commerce) 3️⃣ Dictionary Practice System Managed and updated key-value data Iterated through keys, values, items 👉 Foundation for backend development 4️⃣ Random Experiments Generated random numbers Simulated card shuffling 👉 Core concept behind games and probability systems ⚠️ Challenge I Faced Problem: → Managing multiple data structures together (lists + dictionaries + tuples) got confusing Solution: → Broke the problem into steps: Store data clearly Process user input Apply logic Print results 👉 This structured thinking made everything manageable 💡 Developer Insight Don’t just memorize syntax. 👉 Build small systems where multiple concepts work together Because: Real development = combining simple concepts into one working system 📈 Progress Reflection Today I moved from: “Learning Python concepts” → “Thinking like a developer” Now I can: Design simple programs Handle user input Build logic-driven applications This is real progress toward becoming a full-stack developer 🎯 Tomorrow’s Focus Start file handling (reading/writing files) Build a persistent version of the quiz (save scores) Improve logic structure 🔥 Final Thought Small projects build big skills. You don’t need 100 tutorials… You need 10 projects you truly understand. #buildinpublic #python #codingjourney #learnincode #developers #programming #100daysofcode #softwareengineering #beginners #webdevelopment
To view or add a comment, sign in
-
Whether you're just starting Python or you've been coding for years, there are certain commands and patterns you reach for constantly. Bookmark this: a complete cheat sheet of Python commands you'll use every single day. VARIABLES AND DATA TYPES → Numbers: age = 30, price = 19.99 → Strings: name = "Alice", f"Hello, {name}!" → Booleans: is_active = True → Type checking: type(age), isinstance(age, int) STRING ESSENTIALS → Formatting: f"Total: ${price:.2f}" → Methods: .upper(), .lower(), .strip(), .split() → Searching: .find(), .count(), .startswith() → Slicing: text[0:3], text[::-1] LIST OPERATIONS → Creating: fruits = ["apple", "banana"] → Adding: .append(), .insert(), .extend() → Removing: .remove(), .pop(), del → List comprehensions: [x**2 for x in range(10)] → Filtering: [x for x in range(20) if x % 2 == 0] DICTIONARIES → Access: user["name"], user.get("phone", "N/A") → Modify: user["age"] = 31, user.update({"city": "NYC"}) → Iterate: for key, value in user.items() → Dict comprehensions: {x: x**2 for x in range(6)} LOOPS AND CONTROL → For loops: for i, item in enumerate(list) → While loops with break/continue → Range: range(2, 10, 2) → Zip: for name, age in zip(names, ages) → Ternary: status = "adult" if age >= 18 else "minor" FUNCTIONS → Basic: def greet(name): return f"Hello, {name}!" → Default params: def greet(name, greeting="Hello") → Args/kwargs: def func(*args, **kwargs) → Lambda: lambda x: x**2 CLASSES → Basic class with __init__ and methods → Inheritance: class Dog(Animal) → Dataclasses: @dataclass for simple data containers FILE I/O → Reading: with open("file.txt", "r") as f: content = f.read() → Writing: with open("file.txt", "w") as f: f.write("text") → CSV: csv.reader(), csv.DictReader() → JSON: json.load(), json.dump() ERROR HANDLING → Try/except blocks with specific exceptions → Finally clause for cleanup → Raising custom exceptions COMMON BUILT-INS → Math: abs(), round(), min(), max(), sum() → Type conversion: int(), float(), str(), bool() → Iteration: len(), range(), enumerate(), zip() → Functional: map(), filter(), any(), all() WHY THIS MATTERS Python's strength is in its readability and expressiveness. These patterns aren't just syntax—they're the building blocks of clean, Pythonic code. Mastering these daily-use commands makes you more productive and helps you write code that other developers can easily understand and maintain. Complete Python cheat sheet with examples: https://lnkd.in/dZwv4gNK What Python commands do you find yourself using most often? #Python #Programming #CheatSheet #PythonBasics #Coding #SoftwareDevelopment
To view or add a comment, sign in
-
Episode 8 of What I Can Do With Python This week, I tried something different. This time, instead of using the Streamlit Web App, I extended Microsoft Excel functionality by creating my own custom Excel formula powered by Python. Yes, a Python-Powered Excel function. For a long time, I considered learning VBA so I could build custom formulae tailored to my workflow. But the more I worked with Python, the harder it became to commit to VBA. Compared to VBA, Python just has more tools and is easier to work with, debug and maintain. Inspired by Felix Zumstein's idea in his book, 'Python for Excel', where he stated that "....by learning how to combine Excel with Python, you can have the best of both worlds.", I used the xlwings library to integrate Python directly into Excel. With this, I was able to build a custom Excel formula designed for something many researchers and data analysts deal with often, analysis of demographic characteristics of respondents... In academic research, we usually present the demographic characteristics of respondents as frequency and percentage distributions if categorical variables. Normally, this is done with Pivot Tables, but I wondered, "What if this entire summary could be generated with just one formula?" So I built exactly that. How the Formula Works The first argument is the Excel range containing the categorical data. Once you pass that range, the formula automatically generate a frequency and percentage distribution table. Other optional arguments allow you to: • Control the output • Include or exclude totals • Add or remove percentage signs • Combine summaries or generate them separately • Specify the number of decimal places for percentages. Controlling Category Order By default, the results appear in alphabetical order. But I also implemented a simple trick inspired by SPSS-style value labels. For example, if your dataset contains: Childhood Adolescent Early Twenties Late Twenties Adulthood You can structure the data like this: 1_childhood 2_adolescent 3_early twenties 4_late twenties 5_adulthood The numbers control the order while the prefixes are automatically removed in the final summary. What Happens Behind the Scenes? This project goes beyond basic Python. It involves: • Data manipulation with Pandas • Table reshaping and sorting • Data aggregation • Understanding how xlwings converts Excel ranges into Python objects. The result is a workflow where Python handles the heavy logic while Excel remains the interface. This is the beauty of it, you keep Excel's familiarity, but gain Python's power. This time, instead of a Streamlit app, I'm sharing a demo video showing how the formula works directly inside Excel. Watch the demo and let me know what you think.👇🏼 Is there a business logic or automation you've always wish Excel could do for you? Let's talk about it! See you in Episode 9. #Python #Excel #DataAnalysis #Automation #Researchers #xlwings #BuildingInPublic
To view or add a comment, sign in
-
5 Python mistakes that slow down your code: 1. Using mutable default arguments If your function has `def func(items=[])`, that list persists across all calls. Every Python dev has debugged this at 2am. Use `None` and initialize inside the function. 2. Not using list comprehensions Writing a loop with .append() when a comprehension would be one line and faster. Comprehensions aren't just shorter - they're optimized at the bytecode level. 3. Forgetting context managers for resources Still seeing `f = open('file.txt')` and `f.close()` in production code. If an exception happens between those lines, you leak the file handle. Use `with open()` - that's what it's for. 4. Using `==` to check None, True, False `if x == None` works but `if x is None` is the correct way. Identity checks are faster and handle edge cases better. Same for boolean singletons. 5. No `if __name__ == "__main__":` guard Your script runs differently when imported vs executed directly. Guard your main execution code or your tests will have side effects. 5 Python tips that improved my code: 1. F-strings for everything If you're still using .format() or % formatting, stop. f"Hello {name}" is faster, cleaner, and reads naturally. 2. enumerate() instead of range(len()) `for i, item in enumerate(items)` is more Pythonic than manually tracking indexes. You get both the value and position. 3. dict.get() with sensible defaults `config.get('timeout', 30)` handles missing keys gracefully. No try/except blocks, no KeyError debugging. 4. Multiple assignment and unpacking Python lets you swap variables without a temp: `x, y = y, x`. Unpack lists: `first, *rest = items`. Use it. 5. Pathlib instead of os.path `Path('data') / 'file.txt'` is more intuitive than os.path.join(). It's chainable, handles Windows/Unix differences, and reads like plain English. Most Python mistakes aren't about skill - they're about not knowing the language idioms. Once you learn them, your code gets cleaner and you stop writing Java in Python syntax. #python #engineering #development
To view or add a comment, sign in
-
Day 10 of my Python journey — functions. If I had to choose the single most important concept in software engineering, it would be this: write small, focused, well-named functions. Not because it is a rule. Because it is the only practical way to manage complexity as programs grow larger. A 20-line program can be understood by reading it top to bottom. A 2,000-line program cannot — unless it is broken into functions, each doing one clear thing, each named for what it does, each testable independently. *args and **kwargs — why every Python developer needs to understand these def print_scores(*names): for name in names: print(f"Score recorded for: {name}") print_scores("Rahul") # Works print_scores("Rahul", "Priya", "Arjun") # Also works *args collects any number of positional arguments into a tuple. **kwargs collects any number of keyword arguments into a dictionary. When you call print("a", "b", "c", sep=", ") — that works because print uses *args. When Flask's @app.route("/path", methods=["GET"]) accepts options — that is **kwargs. When requests.get(url, timeout=5, verify=False) takes optional parameters — **kwargs again. Understanding these means understanding how every Python library and framework is designed from the inside. The mutable default argument trap — a famous Python gotcha # DANGEROUS — this is a silent bug def add_task(task, task_list=[]): task_list.append(task) return task_list add_task("Buy groceries") # ["Buy groceries"] — correct add_task("Call dentist") # ["Buy groceries", "Call dentist"] — WRONG The default list is created once when the function is defined. Every call shares the same list. This is one of the most well-known bugs in Python — and I learned it on Day 10. The correct approach: def add_task(task, task_list=None): then task_list = task_list or []. Docstrings — the habit I build from today def calculate_gst(amount: float, rate: float = 0.18) -> float: """Calculate GST on a given amount. Args: amount (float): base price. rate (float): GST rate, default 18%. Returns: float: the GST amount to add.""" return amount * rate Every function I write from now on has a docstring. IDEs read them for autocomplete. Documentation generators build API docs from them. Code reviewers judge them. Professional habit, built from Day 10. Functions are the architecture of every program worth reading. #Python#Day10#ConditionalLogic#SelfLearning#CodewithHarry#PythonBasics#w3schools.com#W3Schools
To view or add a comment, sign in
-
🐍 Coming from Python. Last week I confidently wrote this in Rust: for i in range(1..100) { // 💥 sum += i; } Error: cannot find function 'range' in this scope My brain: “But Rust it’s just Python with semicolons?” That tiny mistake became one of the best lessons I’ve had in systems programming. 🔍 Corrected Rust vs Python Rust fn main() { let number: u32 = 92; if number % 2 == 0 { println!("{} is even", number); } else { println!("{} is odd", number); } let size = match number { 1..=20 => "small", 21..=50 => "medium", 51..=100 => "large", _ => "out of range", }; let mut sum = 0; for i in 1..=100 { sum += i; } println!("Sum = {}", sum); } Python number = 92 if number % 2 == 0: print(f"{number} is even") else: print(f"{number} is odd") if 1 <= number <= 20: size = "small" elif 21 <= number <= 50: size = "medium" elif 51 <= number <= 100: size = "large" else: size = "out of range" total = sum(range(1, 101)) print(f"Sum = {total}") Both do the same job. But the how is completely different. 🧠 Under the Hood – What Rust Forces You to Respect 1. No hidden pointers Python’s number = 92 is a full PyObject on the heap (refcount + type pointer + value). Rust’s u32 lives on the stack one CPU register. Modulo is a single instruction. 2. Zero-cost abstractions Rust’s 1..=20 in match compiles to two integer comparisons (disappears after optimization). No method calls, no temporary objects. 3. The loop reality Rust’s 1..=100 iterator lives entirely on the stack. 100 stack increments. Python’s range(1, 101)creates 100 Python integer objects behind the scenes (heap + refcounting + GC pressure). 4. Match is lightning fast Rust turns match into a jump table or optimized branches. Python’s version (even structural pattern matching) still has runtime overhead. ⚡ The Discipline Rust Teaches Python lets you be productive. Rust forces you to be precise. No more `range()` → Use the `..` syntax directly. Forgetting `mut`? Compiler stops you. Semicolon on last expression? You just returned `()`. This explicitness about memory and ownership is exactly why Rust code is so reliable and fast. Pro tips for Python devs: Treat the compiler like a strict but honest mentor. Understand stack vs heap early — it makes ownership click. Run `cargo clippy` religiously. 💬 Final Thought Rust won’t let you forget that every variable occupies real memory, every loop touches real silicon, and every decision has consequences. Python is a fantastic friend. Rust is a disciplined mentor that makes you a better programmer. Your Python experience is an advantage once you unlearn a few habits. Like ❤️ if you’ve ever tried to use Python syntax in Rust Repost 🔁 to help other Pythonistas Comment💬: What Python habit was hardest for you to break in Rust? #RustLang #Python #RustForPythonDevs
To view or add a comment, sign in
-
-
Every skill has a foundation, and Python is no different. Many beginners rush into libraries like Pandas or NumPy because they hear those names everywhere in data analytics. But the truth is, without a solid grasp of Python basics, those libraries will feel confusing and overwhelming. The first step is to understand variables and data types. Learn how to store values and work with integers, floats, strings, and booleans. These are the building blocks of every script. Next, focus on lists, dictionaries, and tuples. Lists help you manage sequences, dictionaries store key‑value pairs, and tuples handle fixed sets of data. Together, they form the backbone of how Python organizes information. From there, practice loops and conditionals. With for and while loops, you can process data step by step, while if/else statements let you control the flow of logic. Once you’re comfortable, move on to functions. Writing reusable blocks of code makes your work cleaner and easier to maintain. Another essential skill is file handling. Learn how to read and write files, especially CSVs and text files. This prepares you for working with real datasets before you step into Pandas. Alongside this, practice error handling with try/except. Real‑world data is messy, and this skill helps you manage problems gracefully. Finally, don’t overlook string operations. Being able to slice, format, and manipulate text is critical because so much data comes in text form. Once these basics feel natural, moving into Pandas, NumPy, and visualization libraries becomes much smoother. You’ll not only understand what the code is doing you’ll feel confident adapting it to your own problems. Python is like learning a language. Master the alphabet and grammar first, and the essays will follow.
To view or add a comment, sign in
-
-
Day 7/30 — User Input and Simple Programs in Python Today my code stopped being a monologue — and became a conversation. What is input()? input() is a built-in Python function that pauses your program and waits for the user to type something. Once the user presses Enter, whatever they typed is returned as a string — no matter what they entered. The Golden Rule: input() always returns a string — even if the user types a number like 25. Python treats it as text until you explicitly cast it. This is the most important thing to remember today. Syntax Breakdown variable = input("Your prompt message here: ") variable → stores what the user types so you can use it later input() → the built-in function that captures user input The message shown to the user — tells them what to type How It Works, Step by Step ~Python runs your code line by line and reaches input(). ~It prints the prompt message to the screen and pauses ~The user types something and presses Enter ~Python stores that text in your variable as a string ~The program continues running from the next line input() + Type Casting Because input() always returns a string, you must cast before doing any math. Without casting: "1998" - 2025 --> TypeError With casting: int("1998") - 2025 → Works perfectly Example 1: Greeting Program input() pauses and waits, always returns a string name = input("What is your name? ") city = input("What city are you from? ") print("Hello, " + name + "! Great to meet someone from " + city + "!") Output --> What is your name? Obiageli What city are you from? Abuja Hello, Obiageli! Great to meet someone from Abuja! Example 2: Age Calculator python input() returns a string, cast to int before math birth_year = input("Enter your birth year: ") current_year = 2025 age = current_year - int(birth_year) print("You are approximately " + str(age) + " years old.") Output--> Enter your birth year: 1998 You are approximately 27 years old. Key Learnings: ☑ input() pauses the program — always returns a string ☑ The text inside input("...") is the prompt — it guides the user ☑ Always cast with int() or float() before doing math with user input ☑ input() + casting + print() = your first real interactive program ☑ Days 6 and 7 work together — you can't use input() for math without type casting Why It Matters is because every app you've ever used takes input - your name, your password, your order. input() is how Python does the same thing. Today your programs stopped being one-way scripts and became conversations with the user. My Takeaway The moment I ran my first program and it asked me a question — then responded using my name — it felt real. Not just lines of code. An actual program that talks back. That shift is everything. #30DaysOfPython #Python #LearnToCode #CodingJourney #WomenInTech
To view or add a comment, sign in
-
-
🚀 Understanding if __name__ == "__main__": in Python (Once and For All!) 👀 You’ve definitely seen this line before: python code: if __name__ == "__main__": But… do you really know why it exists and when to use it? Let’s break it down in a simple, practical way 👇 🧠 The Core Idea When Python imports a file (module), it doesn’t just import functions… 👉 It executes the entire file. Yes — including: - print() statements - input() prompts - Any top-level logic Even if all you wanted was a single function 😅 ⚠️ The Problem Imagine this scenario: You have a file calculator.py with functions and some executable code. Then you import it into another file: python code: import calculator 💥 Suddenly: - It prints messages - It asks for user input - It runs calculations All before your main program continues 👉 Not because you did anything wrong… 👉 But because that’s how Python imports work ✅ The Solution This is where the magic comes in: python code: if__name__=="__main__": ✨ This line gives you control over execution 🔍 How It Works - When you run a file directly → __name__ == "__main__" - When you import the file → __name__ == "module_name" So: 👉 Code inside this block only runs when the file is executed directly 👉 It does NOT run when the file is imported elsewhere 💡 Best Practice Example python codes: def add(a, b): return a+b def subtract(a, b): return a-b if__name__=="__main__": print("This is a simple calculator") x=int(input("Enter a number: ")) y=int(input("Enter another number: ")) print(add(x, y)) print(subtract(x, y)) 🎯 Why This Matters ✔ Keeps your code clean and reusable ✔ Separates logic from execution ✔ Prevents unwanted side effects during imports ✔ Makes your code interview-ready 💼 🧩 Simple Rule to Remember 👉 Write functions at the top 👉 Put execution/testing code inside if __name__ == "__main__": 🏁 Final Thought If your Python file is meant to be: - 🔁 Reusable (imported elsewhere) - ▶️ Executable (run directly) Then this pattern isn’t optional — it’s essential. 💬 Have you ever run into this issue while importing modules? Let’s discuss! #Python #Programming #SoftwareDevelopment #CodingTips #PythonTips #LearnToCode #TechEducation #Developers
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