🚀 Day 16 of #100DaysOfCoding Today I worked on pattern problems using Python, focusing on nested loops and condition logic. 🔹 Built a hollow square pattern using while loops 🔹 Strengthened understanding of loop control (i, j iterations) 🔹 Learned how to apply conditions for borders vs inner spaces 🔹 Practiced dry run techniques to debug and visualize code execution 💡 Key Learning: Breaking a problem into rows and columns makes pattern questions much easier to solve. The real trick is identifying where to print values and where to skip. Consistency is slowly turning confusion into clarity 💪 #Python #Coding #DSA #Programming #LearningJourney #Consistency n = int(input()) i = 1 while(i <= n): j = 1 while(j <= n): if(i == 1 or i == n): print("*", end="") elif(j == 1 or j == n): print("*", end="") else: print(" ", end="") j += 1 print("") i += 1
Python Pattern Problems with Nested Loops and Conditions
More Relevant Posts
-
Today I focused on understanding one of the most important concepts in Python — Loops 🐍 I learned how loops help in repeating tasks efficiently and make code more powerful. 🔹 Topics Covered: ✔️ for loop and while loop ✔️ Using range() (start, stop, step) ✔️ Iterating over strings and lists ✔️ Nested loops ✔️ Control statements: break, continue, pass 📚 Practice I Did: Factorial without built-in functions Reverse a number using while loop Pattern printing Logical problems using loops 💡 My Learning: Loops are not just syntax — they help in building logic and problem-solving skills, which are essential in programming. Small steps every day → Strong foundation 🚀 👉 Which one do you prefer — for loop or while loop? Let’s connect if you're also learning Python 🤝 #Python #PythonProgramming #CodingPractice #LearnToCode #DeveloperJourney #100DaysOfCode #ComputerScience #ProgrammingBasics #LogicBuilding
To view or add a comment, sign in
-
🚀 Today I practiced Python by building a mini project Created a Number Guessing Game 🎯 What I worked on: • Variables & data types • Loops (while) • Conditional statements (if/elif/else) • Attempt tracking logic What I learned: Building something small helped me understand how logic and flow actually work, instead of just watching tutorials. Challenges I faced: • Managing loop conditions • Tracking attempts correctly Sharing a snippet of my code below 👇 Next: → Building a CLI To-Do List → Improving input validation Staying consistent and learning step by step. #Python #LearningInPublic #CodingJourney #BeginnerDeveloper
To view or add a comment, sign in
-
-
I got tired of scrolling through messy file names… so I fixed it with a small Python script. While reading One Piece manga PDFs, the file names were all over the place: chapter-1112, one-piece-chapter-1222, onepiece-1123, OP-Chapter-1123… Finding the correct order every time was annoying. So I wrote a simple script that: Extracts the chapter number from any format Renames files into a consistent structure Automatically arranges them in readable order Nothing fancy just solving a small personal problem and saving time. This reminded me: You don’t always need big projects. Even small scripts that remove friction from your daily life are worth building. Clean input → Clean output → Peace of mind 😌 #Python #LearningByDoing #Automation #OnePiece #Coding
To view or add a comment, sign in
-
-
Hello everybody, and welcome to this second personal project of 'Learning Python with me'. Today, I have been asked to create a commission calculator for a friend, and we will use Python to make a simple calculator that shows the percentage commission. What do we need? - Name - Income - Commission result Throughout this project, I realized that I needed to convert strings into integers, since the final result had to be a number. I also learned how to use variables in mathematical operations and print them as a final result. Here is how it looks. I hope you enjoy it! :) #Python #PythonProject #SideProject #fyp #Programming #OpsDeveloper
To view or add a comment, sign in
-
While working on a project, I came across something simple but really important .𝐞𝐧𝐯 𝐟𝐢𝐥𝐞𝐬. At first, I was hardcoding things like 𝐀𝐏𝐈 𝐤𝐞𝐲𝐬 and 𝐔𝐑𝐋𝐬 directly into my code. It worked, but it didn’t feel right. That’s when I learned how .𝐞𝐧𝐯 files help keep sensitive data separate from the actual codebase. I put together a quick 4-slide breakdown covering: → What a .𝐞𝐧𝐯 file is → Why it matters → How to use it in Python #Programming #Python #WebDev #SoftwareEngineering #LearnInPublic #DevTips #100DaysOfCode #COMSATS #CUI
To view or add a comment, sign in
-
🔥 Solved a classic Sliding Window problem today 👉 Find a subarray with given sum in O(n) time 💡 Idea: Expand window → add elements Shrink window → when sum exceeds target Stop when sum == target 🧠 Key Insight: Control the window based on sum, not size 🚀 Simple trick, powerful optimization! #DSA #Python #Coding #ProblemSolving #Learning
To view or add a comment, sign in
-
-
At first, I thought creating classes was enough… but then I realized—real power comes from building on top of them. Today’s Python MahaRevision 🧬 Chapter 11: Inheritance & More in OOP This chapter took things a step deeper: → Inheritance (reusing and extending existing classes) → Types of inheritance → Method overriding → Using super() → Exploring more OOP concepts It actually felt like connecting pieces together instead of starting from scratch every time. Practice set done: Worked on creating parent-child classes, modifying behaviors, and experimenting with inherited properties and methods. Biggest takeaway You don’t always need to build everything new—sometimes the smartest approach is to reuse and improve what already exists. Slowly understanding how real-world applications are structured. One step at a time. #Python #LearningInPublic #CodingJourney #Programming #OOP
To view or add a comment, sign in
-
Managing Python environments shouldn’t be a nightmare. But for many — it still is. Here’s how to keep things clean, fast, and production-ready in 2026: 🛠️ Use uv or poetry to manage environments & dependencies. Faster, safer, and simpler than old-school pip+venv. ⚡ Speed matters – use polars, numpy, and numba to vectorize heavy loops. Even small tweaks can give 10× performance wins. 🧼 Lint + Format + Type-check = non-negotiable Ruff for linting Black for formatting Pyright or Pyrefly for fast type-checks 💡 Bonus tip: Use Typer to build CLIs in minutes. So clean, it feels like magic. 💬 What’s one Python setup rule you wish you knew earlier? #Python #CodeQuality #Productivity #DevTools #DataEngineering
To view or add a comment, sign in
-
-
🚀 Stop writing the same code again and again; create a function once and reuse it forever! Function Creation Made Simple: Think of a function like a reusable recipe. Instead of cooking from scratch every time, you write the steps once and reuse them whenever needed. 👉 Example in Python: def greet(name): return f"Hello, {name}!" Now, calling greet("Aditi") instantly gives the following: Hello, Aditi! 🔑 Takeaway: Functions save time, reduce errors, and make your code cleaner. Write once, use forever. Catch you later. Stay tuned for more updates. #Coding #Python #LearningMadeSimple #Functions
To view or add a comment, sign in
-
-
From “it works” to “it won’t break” While writing a code, Getting it to work is one thing, 𝗠𝗮𝗸𝗶𝗻𝗴 𝘀𝘂𝗿𝗲 𝗶𝘁 𝗱𝗼𝗲𝘀𝗻’𝘁 𝗯𝗿𝗲𝗮𝗸 is another. price = products["Laptop"] This works fine… until the 𝗸𝗲𝘆 𝗱𝗼𝗲𝘀𝗻’𝘁 𝗲𝘅𝗶𝘀𝘁 . That’s when the program crashes. So instead of assuming every piece of data is present, Its better to start thinking about what happens when it isn’t. In college projects, we often focus on making things work. In real-world scenarios, 𝗲𝗱𝗴𝗲 𝗰𝗮𝘀𝗲𝘀 matter just as much. 𝗗𝗮𝘆 𝟭𝟮/𝟯𝟬 #Python #LearningInPublic #Day12 #30DaysOfCode #SoftwareEngineering
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