Day 6 of my Python learning journey: Focusing on writing code that's not just functional, but also dependable. Highlights from today: - Warmed up by practicing iterators and generators. - Solved the "First Non-Repeating Character" problem using a clean two-pass frequency approach with O(n) complexity. - Merged two sorted arrays efficiently through the two-pointer technique (O(n + m))—avoiding any redundant sorting. - Developed a FastAPI endpoint for the above problem, complete with schema validation. Observations: Initially, I attempted a one-pass solution for the non-repeating character problem, but it ended up feeling convoluted. Switching to a two-pass strategy made the solution much more straightforward and maintainable. Current focus areas: - Maintaining input order integrity. - Performing input validation early on. - Keeping logic as simple as possible. - Thoroughly testing edge cases beforehand. Major takeaway: Define inputs/outputs upfront → validate data early → then prioritize optimization. Starting to grasp how even minor design decisions can significantly impact code quality. GitHub link: https://lnkd.in/gGPw8_js #Python #FastAPI #ProblemSolving #SoftwareEngineering #CleanCode #LearningInPublic #OOP #Testing
Python Learning Journey: Dependable Code & FastAPI
More Relevant Posts
-
🐍 Day 26 of My 30-Day Python Learning Challenge 🚀 Today I enhanced my Log File Analyzer Project by adding a new feature. 📌 New Feature: Top N Words (User Choice) Instead of showing only top 3 words, users can now choose how many top words they want. 📌 Code: top_n = int(input("Enter number of top words: ")) top_words = sorted(word_count.items(), key=lambda x: x[1], reverse=True)[:top_n] print(top_words) --- 📊 What Changed? • Before → Fixed output (Top 3 words) • Now → Dynamic output (User-defined) --- 💡 Why this matters? • Makes the project flexible • Improves user experience • Closer to real-world applications --- 📊 Quick Question What will happen if user enters a very large number? A) Error B) Full list is returned C) Empty output D) Program stops Answer tomorrow 👇 #Python #MiniProject #ProjectEnhancement #LearningInPublic #SoftwareDeveloper
To view or add a comment, sign in
-
🚀 Day 65 of My Python & DSA Journey Today’s problem was Word Pattern (290) — a great exercise in understanding mapping and relationships between data. 🔍 Problem Solved: Given a pattern and a string, determine if the string follows the same pattern with a one-to-one mapping (bijection) between characters and words. 💡 Approach Used: • Split the string into words • Use two hashmaps (dictionaries): • One for character → word • One for word → character • Ensure consistency in both mappings while iterating ⚡ Key Learnings: • Concept of bijection (one-to-one mapping) • Using hashmaps for efficient lookups • Handling edge cases like unequal lengths • Writing clean validation logic 📊 Complexity Analysis: ✅ Time Complexity: O(n) We traverse the pattern and words once ✅ Space Complexity: O(n) For storing mappings 🎯 Why This Works? Using two dictionaries ensures no duplicates or conflicts, maintaining a strict one-to-one relationship. Another step closer to mastering problem-solving patterns! Under the Guidance of: Rudra Sravan kumar and Manoj Kumar Reddy Parlapalli #Day65 #Python #LeetCode #DSA #Algorithms #CodingJourney #100DaysOfCode #10000Coders 🚀
To view or add a comment, sign in
-
-
🚀 Day 11 – File Handling in Python Today I learned how Python works with files — one of the most practical concepts in real-world applications. 🔹 Files help store data permanently 🔹 We can read, write, and update data anytime 📌 File Modes: • 'r' → Read • 'w' → Write (overwrites file) • 'a' → Append (adds data) • 'x' → Create new file 💡 Best Practice: Using with statement automatically closes the file. 📌 Example: with open("data.txt", "r") as file: content = file.read() print(content) 🔥 Key Learning: File handling is used in logs, reports, user data storage, and real-world applications. Ajay Miryala 10000 Coders #Python #FileHandling #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 21 of My Python Journey – Solved Search Insert Position! 💻✨ Today I worked on a problem that looks simple but really tests your understanding of Binary Search. 📌 Problem Statement Given a sorted array of distinct integers and a target value: Return the index if the target is found If not, return the index where it should be inserted Example: nums = [1,3,5,6] target = 2 ✅ Output: 1 🔍 My Approach I used Binary Search to solve this efficiently. Start with left and right pointers Find the middle element Compare with the target Adjust search space accordingly The interesting part is: 👉 Even if the element is not found, the left pointer ends at the correct insertion position That’s a really neat trick I learned today 💡 💡 Key Learning This problem helped me understand: ✔ Binary Search more deeply ✔ How to find insertion position without extra steps ✔ Writing clean and efficient logic ✔ Handling edge cases ⏱ Complexity Time Complexity: O(log n) Space Complexity: O(1) Small problems like this sharpen the fundamentals really well 🔥 #Python #DSA #BinarySearch
To view or add a comment, sign in
-
-
This week I didn't just write code. I understood what's happening inside it. Here's a recursive function I built 👇 It calculates hotel earnings for N days at ₹5000/day — no loops allowed, only recursion. Watch how Python actually executes it step by step 🎥 What I covered this week: → 🔁 Recursion — functions calling themselves → 📁 File I/O — reading & writing files with Python → 🌐 Internet fundamentals — TCP/IP, HTTP, DNS, REST APIs (Phase 4 done!) Still learning. Still showing up. That's the only formula I know. 💪 💻 Visualization tool: staying.fun 🐍 Language: Python #Python #LearningInPublic #DataAnalytics #Recursion #BBA #100DaysOfCode
To view or add a comment, sign in
-
The moment you add a new condition to an if/else chain in your pipeline, you’ve modified existing code! That’s exactly the smell OCP is meant to catch. 🔍 Open for extension, closed for modification means adding new behavior by writing new code, not patching old one! In my latest article, I break down what OCP looks like in Python data projects: strategy patterns, abstract base classes, and the tradeoffs of when the extra structure is actually worth it. https://lnkd.in/eE9yicvC This is Part 2 of my SOLID series. What’s the most painful “just add another elif” you’ve ever had to maintain? 😅 #Python #SoftwareEngineering #SOLID #DataScience #CleanCode
To view or add a comment, sign in
-
🚀 Day 20 of My Python Journey – Solved Find First and Last Position of Element! 💻✨ Today I worked on finding the first and last occurrence of an element in a sorted array ✅ This problem helped me understand how powerful Binary Search can be when slightly modified. 📌 Problem Statement Given a sorted array, find the starting and ending position of a target value. If the target is not found, return [-1, -1]. Example: nums = [5,7,7,8,8,10] target = 8 ✅ Output: [3,4] 🔍 My Approach Instead of using a normal binary search once, I used it twice: First → to find the first occurrence Second → to find the last occurrence The idea is: When target is found, don’t stop Keep searching on the left side (for first position) Keep searching on the right side (for last position) This small modification makes a big difference 🚀 💡 Key Learning This problem helped me understand: ✔ Advanced Binary Search techniques ✔ How to modify standard algorithms ✔ Handling edge cases carefully ✔ Writing efficient search logic ⏱ Complexity Time Complexity: O(log n) Space Complexity: O(1) Really liked this one because it shows how a basic concept can be extended to solve more complex problems 🔥 #Python #DSA #BinarySearch
To view or add a comment, sign in
-
-
🚀 Solved: Group Anagrams Problem (LeetCode) Today I worked on an interesting problem — grouping anagrams efficiently using Python. 💡 Approach: I used a hashmap (dictionary) where: The key is the sorted version of each word The value is a list of words (anagrams) matching that key Example: "eat", "tea", and "ate" → all become "aet" after sorting → grouped together 🧠 Key Insight: Sorting each string gives a unique identifier for all its anagrams. ⚙️ Time Complexity: Sorting each word takes O(k log k) For n words → O(n * k log k) 📦 Space Complexity: O(n * k) for storing grouped anagrams ✅ Result: Accepted ✔️ Runtime: 5 ms (faster than ~99% submissions) 📈 Growth & Consistency: Improving step by step by solving problems daily and focusing on writing clean and optimized code. Small consistent efforts are helping me build stronger problem-solving skills and deeper understanding of DSA. 🔁 Staying consistent is the real game changer! #Python #DSA #LeetCode #Coding #ProblemSolving #Consistency #Growth #LearningJourney
To view or add a comment, sign in
-
-
Day 18: Today i explored how Python handles memory efficiently using Generators 🔹 What I learned and practiced: ✔️ Generators Functions that return an iterator and produce values one at a time. Great for saving memory when working with large datasets. ✔️ yield Keyword Used to produce a value and pause the function execution. It resumes from the same point when called again, unlike a normal return. ✔️ next() Function Used to retrieve the next value from the generator. Automatically stops when no more values are left to produce. ✔️ Created a square_gen() function to generate squares of numbers one by one. Key takeaway: Generators and yield are powerful tools for writing smarter, more efficient code by only processing what we need, when we need it.and also push in github #Python #codegnan #LearningPython
To view or add a comment, sign in
-
Explore related topics
- Writing Clean Code for API Development
- Python Learning Roadmap for Beginners
- Steps to Follow in the Python Developer Roadmap
- Writing Readable Code That Others Can Follow
- Strategies for Writing Error-Free Code
- How to Refactor Code Thoroughly
- How to Improve Code Maintainability and Avoid Spaghetti Code
- How to Write Maintainable, Shareable Code
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