Count digits. Sum digits. Reverse the number. Check palindrome. Four problems, one loop. Same idea every time: n % 10 gives the last digit, n // 10 removes it. Repeat while n > 0. What you do with each digit is what changes. I wrote a step-by-step practice guide that covers: ✅ The core technique: % 10 and // 10 with a full trace (e.g. 12359) ✅ Challenge 1: Count digits (counter loop) ✅ Challenge 2: Sum of digits ✅ Challenge 3: Reverse a number (rev = rev * 10 + digit) ✅ Challenge 4: Check palindrome (save original, then compare) ✅ Pattern recognition: same loop structure, different use of the digit ✅ Common mistakes (forget n = n // 10, compare n instead of saved copy) and fixes ~9 min read. One technique, four challenges. https://lnkd.in/g4RwH_Er #Python #Programming #Coding #Beginners #LearnToCode #DigitOperations #SumOfDigits #Palindrome #Tech #SoftwareDevelopment #CodingTips
Vimal Thapliyal’s Post
More Relevant Posts
-
✅ Just solved LeetCode 27 — Remove Element! Small problem. Big lesson. 🧠 The task: remove all occurrences of a value from an array in-place and return the count of remaining elements. No extra array. No shortcuts. Just pointer logic. Here's the two-pointer approach I used: def removeElement(nums, val): k = 0 for i in range(len(nums)): if nums[i] != val: nums[k] = nums[i] k += 1 return k 🔍 The insight: → One pointer (i) scans every element → Another pointer (k) tracks valid write position → Overwrite only what doesn't match val → Result? O(n) time, O(1) space ✨ What's your go-to pattern for in-place array problems? Drop it below 👇 #DSA #LeetCode #CodingInterview #Programming #TwoPointers #Python #SoftwareEngineering #100DaysOfCode
To view or add a comment, sign in
-
-
Output: [9, 1, 1, 25, 81] 🧠 filter() + map() chained together! Step 1 — filter() keeps only odd numbers: [3, 1, 1, 5, 9] Step 2 — map() squares each one: [9, 1, 1, 25, 81] ✅ A cleaner, Pythonic way using list comprehension: result = [x**2 for x in nums if x % 2 != 0] Same result, more readable! 🎉 #python #pythonprogramming #coding #programming
To view or add a comment, sign in
-
-
Day 4 of my 100 Days of Code challenge! 💻 Today I built a Rock Paper Scissors game in Python where the user plays against the computer. The program allows the user to choose between rock, paper, or scissors, while the computer randomly generates its choice. It then compares both and determines the winner. This project helped me practice working with lists, the random module, and building game logic using conditional statements. I’m starting to see how combining small concepts can turn into actual interactive programs, which has been really motivating. Learning in public and documenting my journey into software engineering. Check out the project here: https://lnkd.in/eNQhQkz3 #100DaysOfCode #Python #SoftwareEngineering #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
Day 5 of my 100 Days of Code challenge! 💻🐍 Today I built a Password Generator in Python along with completing the classic FizzBuzz problem. 🔐 Password Generator A program that creates a secure password based on user input. The user chooses how many letters, numbers, and symbols they want, and the program randomly generates and shuffles them to create a strong password. 🔢 FizzBuzz A classic problem where numbers from 1–100 are printed, but multiples of 3 show “fizz”, multiples of 5 show “buzz”, and multiples of both show “fizzbuzz”. Today’s focus was practicing: • Loops (for loops) • The random module • Lists and list manipulation • The modulo operator % • Building and combining logic step by step Learning in public and documenting my journey into software engineering. Check out the projects here: https://lnkd.in/eCYaEybF #100DaysOfCode #Python #SoftwareEngineering #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
Day 10/100 – DSA Challenge Today’s problem: Move Zeroes (LeetCode 283) What I Learned: The goal was to move all zeroes to the end of an array while maintaining the relative order of non-zero elements — and importantly, doing it in-place. Key Idea: Two-Pointer Technique I used a two-pointer approach: One pointer (fast) iterates through the array Another pointer (slow) tracks where the next non-zero element should go Whenever a non-zero element is found, it is swapped with the element at the slow pointer, ensuring all non-zero elements are shifted forward while zeroes naturally move to the end. Why this approach? Maintains order of elements Works in O(n) time complexity Uses O(1) extra space (in-place) Takeaway: This problem reinforced how powerful the two-pointer technique is for array manipulation problems, especially when constraints require in-place operations. Looking forward to tackling more problems and improving consistency! #Day10 #100DaysOfCode #DSA #Python #CodingJourney #LeetCode #ProblemSolving
To view or add a comment, sign in
-
-
🚀 30 𝐃𝐚𝐲𝐬 𝐨𝐟 𝐏𝐲𝐭𝐡𝐨𝐧 — 𝐃𝐚𝐲 #13 | 𝐈𝐧𝐭𝐞𝐫𝐦𝐞𝐝𝐢𝐚𝐭𝐞 & 𝐀𝐝𝐯𝐚𝐧𝐜𝐞𝐝 𝐍𝐞𝐬𝐭𝐞𝐝 𝐋𝐨𝐨𝐩𝐬 Day 13 was focused on learning intermediate and advanced concepts of nested loops. Today, I explored how loops can be placed inside other loops to create more structured and complex program flows. Understanding this concept helped me see how programs handle multi-level iterations. 📌 𝐖𝐡𝐚𝐭 𝐈 𝐂𝐨𝐯𝐞𝐫𝐞𝐝: 🔹 Intermediate nested loop structures 🔹 Advanced nested loop logic 🔹 How loops interact with each other inside different levels 🔹 Using nested loops to generate different patterns 💡 𝐊𝐞𝐲 𝐓𝐚𝐤𝐞𝐚𝐰𝐚𝐲: - Nested loops are powerful when it comes to handling multi-level iteration and pattern-based logic. - Understanding how each loop controls rows and columns is key to mastering patterns. A 𝐡𝐮𝐠𝐞 𝐬𝐡𝐨𝐮𝐭𝐨𝐮𝐭 𝐭𝐨 𝐭𝐡𝐞 𝐂𝐨𝐝𝐞 & 𝐃𝐞𝐛𝐮𝐠 𝐘𝐨𝐮𝐓𝐮𝐛𝐞 𝐜𝐡𝐚𝐧𝐧𝐞𝐥 for explaining these concepts so clearly and making even complex topics easy to understand. The structured explanations really make learning smoother. 𝐃𝐚𝐲 13 𝐜𝐨𝐦𝐩𝐥𝐞𝐭𝐞 ✅ Each concept is helping me think more logically about programming. 💻✨ #Python #30DayChallenge #Day13 #NestedLoops #PatternProgramming #PythonLearning #CodingJourney #LearnToCode #Programming #TechGrowth
To view or add a comment, sign in
-
-
Built a terminal LLM playground over the past few days. You pick 2 models, send a prompt, and get both responses back to back so you can actually compare them. Token counts, temperature, max tokens are all adjustable on the fly. Called it LAB. Stack: Python, Groq API (free), Rich GitHub: https://lnkd.in/dpWq6Vwy Try it on your own computer Stay tuned for more projects like this
To view or add a comment, sign in
-
Just created my new tool and named it "ZIGBACK" for obvious reasons. It's a small red-team style experiment: dynamically generating a Zig-based reverse shell via Python and compiling it in real time. Chose Zig specifically for its low-level control, minimal runtime footprint, and ability to produce lean, dependency-free binaries ,which makes it very useful when you want to precisely understand how detection engines react to specific behaviors. Tested it against default Windows Defender to observe detection behavior. With careful API usage and structure, it remained Undetected , highlighting how much detection still depends on patterns rather than intent. Currently it is the first release, will be updating with a few more features. More to come!! 🤖 #redteaming #redteamtool #defenderbypass
To view or add a comment, sign in
-
They wanted the maximum of 5 numbers. The program printed 0. Every number was negative. max = 0 fails when all inputs are negative. Read the first number into max, then loop for the rest. One idea, two bugs avoided. I wrote a beginner guide that covers two classics in one: ✅ Maximum of N numbers — read first into max, loop N−1 times, update if larger (and why not max = 0) ✅ Decimal to binary — divide by 2, collect remainders, reverse. In code: prepend to a string. ✅ Why the "build as number" method loses leading zeros (and why string method is correct) ✅ Full programs: max of N and decimal-to-binary with n=0 handled ✅ Summary, takeaways, and next steps (min, binary→decimal) ~6 min read. Straight to the point. https://lnkd.in/gqJWam9x #Python #Programming #Coding #Beginners #LearnToCode #Maximum #DecimalToBinary #Binary #WhileLoop #Practice #Tech #SoftwareDevelopment #CodingTips
To view or add a comment, sign in
-
More from this author
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