🔤 DAY 2/30: I CAN NOW MANIPULATE TEXT LIKE A PRO Today I learned string methods in Python - functions that transform text. 📚 WHAT I LEARNED: • .strip() - remove extra spaces (clean user input) • .upper() / .lower() - change case instantly • String slicing - grab specific parts of text [start:end] • .replace() - swap words in seconds 🛠️ PROJECT: Username Validator A program that: 1. Takes any messy username input 2. Cleans it (removes spaces, fixes case) 3. Validates length (5-15 characters) 4. Tells you if it's available 💡 BIGGEST INSIGHT: String methods don't change the original - they create a NEW string. That's why you need to save them: `name = name.strip()` 🐛 BUG I FIXED: Forgot to save the cleaned string - kept getting original. Now I know: methods RETURN values, they don't modify in place. 📂 DAY 2 CODE: https://lnkd.in/gvg2Rh6N 28 days to go. Getting stronger every day. #Python #30DaysOfCode #CodingJourney #LearnToCode
More Relevant Posts
-
🚀 Day 4 of #14DaysOfPython 🐍 Today’s focus: Strings (Core Concepts) — working with text in Python. 💡 Easy way to understand strings: 🔹 Why strings? 👉 Almost every real-world program deals with text (names, inputs, data processing) 💡 Core Concepts (Logic First): 🔹 String Indexing & Slicing 👉 Access characters using position s[0] → first character s[-1] → last character s[start:end] → substring 🔹 String Traversal 👉 Loop through characters for loop → simple iteration while loop → more control 🔹 Built-in Methods 👉 Modify strings easily lower(), upper() → case change strip() → remove spaces replace() → replace characters 🔹 ASCII Basics 👉 Convert between characters and numbers ord('A') → 65 chr(65) → 'A' 🧠 Problems I practiced: Palindrome check Reverse a string Count vowels & consonants Remove spaces from a string ✨ Key takeaway: Strings are not just text — they are data you can manipulate step-by-step using logic. Day 4 done ✅ Moving to Day 5 💪 #HackerRank #Python #ProblemSolving #CodingJourney #Developer #LearningInPublic #codegnan
To view or add a comment, sign in
-
-
Day 11/365: Finding the Smallest & Second Smallest Element in a List 🔍📉 Today I worked on a classic list problem in Python: finding the smallest and second smallest elements in a list, along with their indexes — without sorting the list. What this code does step by step: I start with a list L containing different numbers. I initialize two variables: smallest and s_smallest (second smallest) with a value larger than most of the elements in the list. I also track their positions using smallest_index and second_smallest_index. Then I loop through the list using indexes: If the current element is less than or equal to smallest, I: move the current smallest to s_smallest, update smallest with the new value, and update both indexes accordingly. Else if the current element is only smaller than s_smallest, I update just the second smallest and its index. In the end, I print both the smallest and second smallest values with their positions in the list. What I learned from this exercise: How to track not just one, but two minimum values in a single pass through the list. How important it is to maintain both the value and the index while updating. How careful initialization of variables (like smallest and s_smallest) affects the correctness of the logic. How this pattern can be extended to find top-k smallest or largest elements efficiently without sorting. Day 11 done ✅ 354 more to go. If you have ideas like handling edge cases (e.g., duplicates, negative numbers, very large lists) or finding the k-th smallest element, send them my way — I’d love to build on this next. #100DaysOfCode #365DaysOfCode #Python #LogicBuilding #Lists #Indexing #CodingJourney #LearnInPublic #AspiringDeveloper
To view or add a comment, sign in
-
-
Day 2 of my LeetCode journey 🚀 Today’s problem: Group Anagrams This challenge was all about grouping strings that share the same characters. I approached it using a dictionary + hashing strategy in Python. For each word, I sorted its characters and used that as a key (converted into a tuple), ensuring all anagrams map to the same bucket. Here’s the core logic I implemented: ▪️Traverse the list of strings ▪️Sort each string → convert to tuple → use as dictionary key ▪️Append original string to the corresponding group ▪️Finally, return all grouped values This approach keeps the implementation clean and scalable. Time Complexity: ▪️Sorting each string takes O(k log k) (where k = length of string) ▪️For n strings → O(n * k log k) overall Space Complexity: ▪️O(n * k) for storing grouped anagrams A solid step forward in understanding how hashing + transformations can simplify complex grouping problems. Staying consistent and leveling up daily 💪 #LeetCode #Day2 #Python #DSA #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
🚨 This behavior of Python might look like a BUG… but it isn’t actually. a = 10 b = 10 print(id(a)) print(id(b)) 👉 Same memory location 😲 “Why do we have two variables pointing to the same memory location?!” Here comes the second one and things get interesting 👇 a = [1, 2, 3] b = a b.append(4) print(a) # [1, 2, 3, 4] 🔥 👉 Hmmm… why did ‘a’ change?! 💡 Explanation: ⭐ id() returns the identity of an object ⭐ Python reuses memory locations for immutable values ⭐ For mutable objects however, there is no copying, just pointers! ⚠️ The misconception: Most people believe ‘=’ copies objects in variables. 👉 Nope! ✅ Solution: b = a.copy() Now the two variables are separate ✅ 🔥 Consequence: It can seriously mess up your program’s logic! Ever got caught by such a ghost bug in Python? 👇 #CodeWithSujith #Python #Programming #Coding #PythonTricks #LearnPython #PythonBeginner #100DaysOfCode #DeveloperJourney
To view or add a comment, sign in
-
-
🚀 Day 12/30 of My LeetCode Journey (Python + SQL) Consistency continues… and the concepts are getting sharper! 💻🔥 🔹 **SQL Problem of the Day** 👉 *Invalid Tweets* Given a `Tweets` table, write a query to find tweet IDs where the content length is strictly greater than 15 characters. 💡 *Key Concept:* String functions like `LENGTH()` for validation. 🔹 **Python Problem of the Day** 👉 *Single Number* Given an array where every element appears twice except one, find that single element. 💡 *Key Concept:* Bit manipulation using XOR for optimal O(n) time and O(1) space. Loving how problem-solving is becoming more intuitive day by day ⚡ Day 12 done ✅ #LeetCode #30DaysChallenge #Python #SQL #CodingJourney #Consistency #ProblemSolving #Learning #BitManipulation
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
-
-
Day 18 revision done. Operators. If/Else. Match statements. While loops. For loops. Not just reading through notes this time actually writing the code out, making mistakes, fixing them and doing it again until it felt natural. And honestly? It's working. The things that confused me the first time around are starting to make sense now. I finally get why // and % are different. I understand why indentation is not optional in Python. I know when to use a while loop vs a for loop. Revision isn't glamorous. There's no big aha moment. It's just you sitting down, doing the work and trusting that repetition builds confidence. And slowly it is making sense It is finally sticking and guess what I'm happy. Because Python is one of the most amazing tools used in the data space and I'm out here learning it on my own. Day 19 is next. Let's keep going. #Python #100DaysOfCode #SelfTaught #GrowthMindset #DataAnalysis #W3schools
To view or add a comment, sign in
-
Most developers waste hours on bad code. All because they skip one simple thing. 🔥 How Python Functions Work 👇 Stage 1: Plan ──▶ Pick a task ──▶ Name your function Stage 2: Write ──▶ Use def keyword ──▶ Add your logic Stage 3: Input ──▶ Pass your values ──▶ Set parameters Stage 4: Run ──▶ Call the function ──▶ See the output Stage 5: Reuse ──▶ Call it again ──▶ Save more time Functions keep your code clean. They save time. They make fixing bugs easy. Write once. Use many times. That is the real power of Python. 💡 Have you written your first Python function yet? Drop a YES or NO below 👇 #Python #PythonBasics #LearnPython #CodingForBeginners
To view or add a comment, sign in
-
Day 5 of #30DaysOfPython ✅ Today I met two of Python's most powerful data structures. One of them already feels like home. The other? Slightly chaotic. Lists and dictionaries. Day 5. Lists made sense quickly — they're just ordered collections. I can store things, loop through them, sort them, slice them. Intuitive. Dictionaries? At first, the key-value pair concept felt abstract. The bug that got me today? I threw both strings and integers into the same list and tried to sort it. Python did not appreciate that. TypeError showed up like an old enemy. Day 5 done. 25 more to go! 👇 Lists vs dictionaries — when do you reach for one over the other? #Python #30DaysOfPython #DataStructures #StudentLife #AIML
To view or add a comment, sign in
-
-
🚀 Day 6/30 of My LeetCode Journey (Python + SQL) Consistency is slowly turning into confidence 💪📈 🔹 **Python Problem of the Day** 👉 *Plus One* Given an integer represented as an array of digits, increment the number by one and return the resulting array. 💡 *Key Concept:* Handling carry from the last digit (especially edge cases like 9 → 10). 🔹 **SQL Problem of the Day** 👉 *Game Play Analysis I* Given a table of player activity, write a query to find the first login date for each player. 💡 *Key Concept:* GROUP BY with MIN() to extract earliest dates. Every day learning something new, refining logic, and improving speed ⚡ Day 6 done ✅ #LeetCode #30DaysChallenge #Python #SQL #CodingJourney #Consistency #ProblemSolving #Learning
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