Day 12/30 🔹 Problem: Print multiplication table of a number 🔹 What I focused on today: Using loops to repeat calculations efficiently 🔹 My Thinking Process: Take a number as input Use a loop from 1 to 10 Multiply the number with each value Print the result step by step 👉 Repetition becomes easy with loops 🔹 Inputs I used: A number 🔹 Code: num = int(input("Enter a number: ")) for i in range(1, 11): result = num * i print(num, "x", i, "=", result) 🔹 Example: Input: 5 Output: 5 x 1 = 5 5 x 2 = 10 5 x 3 = 15 ... 5 x 10 = 50 🔹 Key Takeaway: Loops help automate repetitive tasks, making code more efficient and scalable #Day12 #Python #30DaysOfCode #LearningInPublic #DataAnalytics #ProblemSolving
Python Multiplication Table with Loops
More Relevant Posts
-
𝗗𝗮𝘆 𝟯 | 𝗢𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀 𝗮𝗻𝗱 𝗯𝗮𝘀𝗶𝗰 𝗶𝗻𝘁𝗲𝗿𝗮𝗰𝘁𝗶𝗼𝗻 Today’s session felt more practical compared to the previous ones, as I started working with operations and user interaction. 𝗧𝗼𝗽𝗶𝗰𝘀 𝗰𝗼𝘃𝗲𝗿𝗲𝗱: 💠 Arithmetic operators such as addition, subtraction, multiplication, and division 💠 Comparison operators like greater than, less than, and equal to 💠 Logical operators including and, or, and not 💠 Taking input from the user using input() 💠 Displaying output using print() Combining these concepts in small programs made things clearer. It now feels like I am actually using Python rather than just understanding theory, and that shift is making the learning more interesting. #Python #Operators #CodingBasics #DataAnalysis #LearningJourney
To view or add a comment, sign in
-
Today I worked on a classic string manipulation problem that looks simple but tests your understanding of logic and edge cases. 🔍 Problem: Given a string and a substring, count how many times the substring appears in the main string. ⚠️ The catch? 👉 You must count overlapping occurrences as well. 💡 Approach I Used: Instead of using built-in shortcuts, I applied a sliding window technique: ++Loop through the string ++Extract a substring of the same length ++Compare it with the target substring ++Increment count when matched This ensures we don’t miss overlapping patterns. 🧠 Key Learning: Sometimes, simple problems reveal powerful concepts. This one reinforces: ++String slicing ++Loop boundaries ++Sliding window logic 📌 Example: "ABCDCDC" → "CDC" appears 2 times (including overlap) 💻 Check out the visuals: 🖼️ Problem breakdown 🧑💻 Python solution 🔥 Why this matters? This pattern is widely used in: --Text processing --Pattern matching --Data parsing #Python #HackerRank #CodingPractice #DataStructures #ProblemSolving #100DaysOfCode #LearningInPublic #SoftwareEngineering
To view or add a comment, sign in
-
-
Today I worked on a classic 2D array problem: Hourglass Sum. At first glance, it looks tricky—but the key insight is recognizing the pattern: Each hourglass uses 7 elements We only need to iterate up to index 4 (since it's a 6×6 grid) Track the maximum sum while scanning This problem reinforced how breaking a problem into patterns simplifies logic. Small wins like these build strong fundamentals in data structures. #DataStructures #ProblemSolving #Coding #Python #Learning
To view or add a comment, sign in
-
-
🚀 Solved a great problem today: “Consecutive 1’s Not Allowed” At first glance, it looked like a simple binary string problem… but it quickly turned into a lesson in pattern recognition and dynamic thinking. 📌 What the problem was about: Count all binary strings of length n such that no two 1’s are consecutive. 💡 What I learned: Instead of brute forcing all combinations (which would be exponential), the key was to observe a pattern: If a string ends with 0 → we can add 0 or 1 If it ends with 1 → we can only add 0 This leads to a recurrence: 👉 dp[n] = dp[n-1] + dp[n-2] Which is basically the Fibonacci pattern in disguise. 🧠 Big takeaway: Many problems are not about coding harder… they’re about seeing the hidden pattern behind the problem. This was a reminder that: Brute force is rarely the answer Thinking in terms of state transitions is powerful Optimization often comes from observation, not syntax 📷 Sharing my solution screenshot below 👇 #DataStructures #DynamicProgramming #ProblemSolving #Python #LearningInPublic #DataAnalyticsJourney
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
-
Today I worked on an interesting string problem — counting how many times a substring appears in a string without using built-in methods like count(). At first, it seemed straightforward… until I realized an important twist 👇 👉 Built-in count() does not handle overlapping substrings So I implemented a manual sliding window approach: 🔹 Traverse the string from left to right 🔹 Extract substrings using slicing 🔹 Compare each slice with the target substring 🔹 Increment count when a match is found 💡 Example: String → ABCDCDC Substring → CDC There are 2 occurrences, not 1 — because overlapping is allowed. This small problem helped me understand: How string slicing works internally Why built-in functions aren’t always sufficient The importance of handling edge cases like overlapping 🧠 Key takeaway: Sometimes writing logic manually gives deeper insight than relying on shortcuts. Learning step by step and enjoying the process 🔥 #Python #CodingJourney #100DaysOfCode #ProblemSolving #DataStructures #Learning
To view or add a comment, sign in
-
My thesis was stuck. A matrix had the wrong shape and I had no idea why. I could have printed the entire dataset to find the error. I did not. Instead I used Python's debugger. One breakpoint. One look at the intermediate state. Wrong dimensions. Found in seconds. That moment changed how I work. Not because debugging saved my thesis. But because it taught me something I still use every day: You do not need to see all the data to understand what is wrong. You just need to see the right data at the right moment. Since then, every time a pipeline breaks or a model behaves unexpectedly, I reach for the debugger first. Not print statements. Not guesswork. A breakpoint. An intermediate result. A clear answer. Debugging is not a last resort. It is the fastest way to understand what your code is actually doing. What is your go-to strategy when something breaks unexpectedly? #Python #Debugging #DataScience #MachineLearning #FreelanceDataScientist
To view or add a comment, sign in
-
-
🚀 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
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
-
-
Most analyses without correct inference, are measuring the wrong thing. I worked on a causal inference project using DiD and PSM to find the actual effect of a loyalty program on churn. Not correlation, Not gut feeling. Causation! Two methods. Both agreed: ~8pp churn reduction. Code on GitHub. Full walkthrough on YouTube 👇 #CausalInference #DataScience #Python #Statistics
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