“Something new I learned in Python today” Even a correct mathematical function can misbehave because of floating-point precision. Replacing: math.ceil(x / d) with (x + d - 1) // d made the solution both safer and faster :) Love how debugging often turns into unexpected learning ;) #Python #CodingJourney #Debugging #LeetCode
Python Debugging Tip: math.ceil Alternative
More Relevant Posts
-
Day 15 | Problem-Solving Practice Today I worked on number system conversions: • Decimal to Octal • Octal to Decimal Implemented both mathematical logic and built-in approaches to strengthen conceptual understanding along with practical usage. GitHub: https://lnkd.in/g35tV9Gj “Discipline is choosing what you want most over what you want now.” #ProblemSolving #Python #LearningInPublic #Consistency
To view or add a comment, sign in
-
Day 14 | Problem-Solving Practice Back to practice and worked on number system conversions today: • Binary to Decimal conversion • Decimal to Binary conversion Implemented both mathematical logic and built-in approaches to understand the underlying concept as well as practical shortcuts. Continuing to rebuild momentum step by step. GitHub: https://lnkd.in/g35tV9Gj #ProblemSolving #Python #LearningInPublic
To view or add a comment, sign in
-
🚀 Python Learning Journey – Revision Day Today, I revised Day 7, Day 8, and Day 9 topics to strengthen my fundamentals. Here’s what I revised: ✅ Functions (def, arguments, return values) ✅ Built-in string functions ✅ List built-in methods and functions Revision helped me understand concepts more clearly and confidently. Practicing consistently and building a strong foundation 💪 Small steps every day lead to big results. #Python #LearningJourney #Revision #Functions #Strings #Lists #KeepLearning
To view or add a comment, sign in
-
Learn in Public — Day 15 Today I studied Selection Sort and implemented it in Python. 🔹 Key Idea: Selection Sort repeatedly finds the minimum element from the unsorted part of the array and places it at the correct position in the sorted part. 🔹 How it works: 1️⃣ Start from the first element 2️⃣ Find the smallest element in the remaining array 3️⃣ Swap it with the current position 4️⃣ Repeat for the rest of the array 🔹 Complexity: Time Complexity: O(n²) Space Complexity: O(1) (in-place sorting) Even though Selection Sort is not efficient for large datasets, it’s a great algorithm for understanding how sorting works internally. Every small step builds the foundation for mastering algorithms. #LearnInPublic #100DaysOfCode #Python #Algorithms #DataStructures
To view or add a comment, sign in
-
-
Learn in Public – Day 13 Today I practiced implementing the Armstrong Number problem in Python using two different approaches. 🔹 Approach 1: Converting the number to a string and calculating the power of each digit. 🔹 Approach 2: A more mathematical approach using functions like order() and a recursive power() function. Key learnings from today: • How Armstrong numbers work mathematically • Practicing recursion through a custom power function • Working with digits using modulus and integer division • Writing cleaner modular functions Example: 153 → 1³ + 5³ + 3³ = 153 Consistency > Motivation. #LearnInPublic #Python #CodingPractice #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Learn in Public — Day 11 Today I explored multiple ways to compute the Greatest Common Divisor (GCD) in Python. Implemented several approaches: • Brute force approach using iteration • Recursive subtraction-based GCD • Optimized recursive version • Euclidean algorithm using modulo • Python's built-in math.gcd() function Key takeaway: The Euclidean Algorithm is significantly more efficient than the naive approach because it reduces the problem size quickly using modulo operations. This exercise helped me understand how the same problem can be solved with different algorithmic strategies — each with different time complexities and performance trade-offs. Consistently learning and improving every day. #LearnInPublic #Python #Algorithms #DataStructures #CodingJourney #SoftwareEngineering #ProblemSolving
To view or add a comment, sign in
-
-
Day 10 of #50DaysOfPython Today’s concept: Sum of digits of a number. A simple yet important problem to understand loops, arithmetic operations, and number manipulation in Python. Swipe through the slides to see the explanation, code, and output #50DaysOfPython #PythonLearning #CodingLife #LearnToCode
To view or add a comment, sign in
-
Day 20/100 – #100DaysOfCode 🚀 Solved LeetCode #448 – Find All Numbers Disappeared in an Array (Python). Today I worked on an array problem to find all the numbers in the range [1, n] that are missing from the given array. Approach: 1) Convert the array into a set for quick lookup. 2) Traverse numbers from 1 to n. 3) Check if each number exists in the set. 4) If not present, add it to the result list. 5) Return the final list of missing numbers. Time Complexity: O(n) Space Complexity: O(n) Learning how sets help in fast lookup and simplify problems 💪 #LeetCode #Python #DSA #Arrays #HashSet #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🔢 Day 23 – Matrix Problems in Python 🚀 Today, I continued my Python problem-solving journey by practicing Matrix problems. Matrices help strengthen nested loops, indexing, and logical thinking, which are essential for coding interviews and real-world problem solving. 📌 Topics Covered: ✔️ Accessing rows and columns ✔️ Printing specific rows or columns ✔️ Diagonal elements (Primary & Secondary) ✔️ Row-wise and column-wise operations ✔️ Matrix traversal using loops #Day23 #Python #Matrix #ProblemSolving #LearningInPublic #CodingJourney
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