Most people quit learning Python halfway through a tutorial. Not because it's too hard. Because solving fake problems on fake datasets feels pointless. Here's what worked for me: I stopped treating Python like a subject to study and started treating it like a game to beat. Games give you context that tutorials don't. You're not learning "while" loops to pass a quiz. You're learning them to make your robot escape a dungeon or your spaceship dodge asteroids. Same syntax. Totally different motivation. Here are the games that taught me Python without feeling like school: ➡️ CheckiO (checkio.org) Coding challenges disguised as island missions. You unlock levels by solving puzzles with Python. Before you know it, you've mastered loops and conditionals. ➡️ CodinGame (codingame.com) Build AI bots that compete in real-time multiplayer games. Your code controls racing cars, battle droids, and strategy units. Addictive and practical. ➡️ Python Challenge (pythonchallenge.com) A riddle game where every level requires Python to crack. Cryptic, frustrating, and weirdly satisfying when you finally solve it. Teaches problem-solving, not memorization. ➡️ Code Combat (codecombat.com) Fantasy RPG where you write Python to control your character. Move, attack, cast spells — all through code. Works for beginners and advanced players. ➡️ Screeps (screeps.com) MMO strategy game where you program your colony. Automate resource gathering, defense, and expansion. High learning curve, insanely rewarding once it clicks. The reason these work better than tutorials? They give you a reason to care. Tutorials teach syntax in isolation. Games teach syntax in context. You remember "for" loops because you needed them to make your robot move faster. You remember list comprehensions because they helped you filter enemies in battle. Same Python. Better reason to keep going. Shoutout to Karina Samsonova for her SQL game list - she nailed this concept. Dry exercises kill motivation. Games make the syntax stick because the problems feel real, even if they're wrapped in a murder mystery or a space battle. If you've been stuck halfway through a Python tutorial (or avoiding starting at all), try a game instead. Pick one. Play for 30 minutes. You'll be writing code without realizing you're learning. #sql #python #coding
Learn Python with Games Not Tutorials
More Relevant Posts
-
⚠️ Python Gotcha — The Mutable Default Argument Trap! This code looks innocent, but behaves surprisingly. Can you guess the output? 🔍 WHAT MOST BEGINNERS EXPECT: print(add_item(1)) → [1] print(add_item(2)) → [2] ⚠️ WHAT ACTUALLY HAPPENS: print(add_item(1)) → [1] print(add_item(2)) → [1, 2] 😲 🔍 WHY THIS HAPPENS: Step 1 → Default arguments are created ONCE when the function is defined Step 2 → Not created each time the function is called Step 3 → 'lst = []' creates a single list that persists Step 4 → Every call shares the SAME list object Step 5 → First call → [1] Step 6 → Second call → [1, 2] Step 7 → Third call → [1, 2, 3] and so on... ✅ HOW TO FIX IT: def add_item(item, lst=None): if lst is None: lst = [] lst.append(item) return lst print(add_item(1)) # [1] print(add_item(2)) # [2] ⚠️ EDGE CASES: Multiple calls → List keeps growing unexpectedly Different arguments → Still shares the same list Function used elsewhere → Unexpected side effects Debugging nightmare → Hard to trace where the list changed 📌 REAL-WORLD APPLICATIONS: 🐛 Debugging → Understanding unexpected behavior 📚 Learning → Teaching Python fundamentals ✅ Code Reviews → Catching this common mistake 🔧 Best Practices → Always use None as the default for mutable types 📝 Interviews → Classic Python interview question 💡 KEY CONCEPTS: • Default arguments → Evaluated once at function definition • Mutable objects → Lists, dictionaries, and sets behave this way • Immutable objects → Integers, strings, and tuples are safe • None as default → Standard workaround pattern • Object reference → Same memory location shared • Side effects → Unexpected modifications 📌 QUICK CHECK: What will this print? def add_item(item, lst=[]): lst.append(item) return lst print(add_item(1)) print(add_item(2)) print(add_item(3)) Answer: [1] → [1, 2] → [1, 2, 3] 👇 Drop your experience — have you ever faced this bug? #Python #PythonGotchas #Coding #Programming #LearnPython #Developer #Tech #Debugging #PythonTips #CommonMistakes #MutableDefaultArguments #Day75
To view or add a comment, sign in
-
-
Day 12 of my Python learning journey Today I tried solving a problem that felt like an extension of Two Sum, but it was a bit more tricky. Problem: 3 Sum (using Two Pointers) Given an array, find all unique triplets such that their sum is equal to 0. Example: arr = [-1, 0, 1, 2, -1, -4] Output: [[-1, -1, 2], [-1, 0, 1]] What I learned today: Instead of checking all possible triplets (which is slow), we can: Sort the array first Fix one element Use Two Pointers to find the other two numbers How it works: Fix one number arr[i] Start left from i+1 Start right from the end Check the sum of three numbers • If sum is too small → move left pointer • If sum is too large → move right pointer • If sum is 0 → store the triplet Code I wrote: arr = [-1, 0, 1, 2, -1, -4] arr.sort() result = [] for i in range(len(arr) - 2): if i > 0 and arr[i] == arr[i - 1]: continue left = i + 1 right = len(arr) - 1 while left < right: s = arr[i] + arr[left] + arr[right] if s == 0: result.append([arr[i], arr[left], arr[right]]) while left < right and arr[left] == arr[left + 1]: left += 1 while left < right and arr[right] == arr[right - 1]: right -= 1 left += 1 right -= 1 elif s < 0: left += 1 else: right -= 1 print(result) Problems I faced while coding this: At first I tried using three nested loops, but it became too slow. I did not understand why sorting is necessary. I got duplicate triplets and didn’t know how to remove them. The duplicate skipping logic with while loops confused me a lot. What I finally understood: Sorting helps us use the Two Pointer technique and also makes it easier to avoid duplicates. This approach reduces complexity from O(n³) to O(n²). Time and Space Complexity: Time Complexity: O(n²) → one loop + two pointer traversal Space Complexity: O(1) (excluding the output list) Question: Why do we skip duplicates using: if i > 0 and arr[i] == arr[i - 1]: Today’s realization: Some problems look like small extensions, but the logic becomes much deeper. #Python #DSA #Coding #Programming #LearningInPublic #100DaysOfCode #PythonProgramming
To view or add a comment, sign in
-
-
Day 13 of my Python learning journey Today I worked on a classic problem that looks simple, but teaches a very powerful idea. Problem: Sort 0s, 1s, and 2s (Dutch National Flag Problem) Given an array containing only 0, 1, and 2, sort it in-place. Example: arr = [2, 0, 2, 1, 1, 0] Output: [0, 0, 1, 1, 2, 2] What I learned today: Instead of using sorting functions, we can solve this in one pass using pointers. This problem is known as the Dutch National Flag problem. What is Dutch National Flag idea? This concept was given by Edsger Dijkstra. The idea comes from the Dutch flag, which has three colors: Red, White, Blue We map them like this: 0 → Red 1 → White 2 → Blue So the goal is to arrange elements in this order, just like the flag. How the logic works: We divide the array into three parts: Left → all 0s Middle → all 1s Right → all 2s And we maintain three pointers: low → where 0 should go mid → current element high → where 2 should go Code I wrote: arr = [2, 0, 2, 1, 1, 0] low = 0 mid = 0 high = len(arr) - 1 while mid <= high: if arr[mid] == 0: arr[low], arr[mid] = arr[mid], arr[low] low += 1 mid += 1 elif arr[mid] == 1: mid += 1 else: arr[mid], arr[high] = arr[high], arr[mid] high -= 1 print(arr) Problems I faced while coding this: At first I tried using sort(), but that defeats the purpose of the problem. I was confused about why we use three pointers instead of two. The condition mid <= high was tricky to understand. I also made mistakes while swapping, which broke the logic. What I finally understood: This algorithm processes each element only once. We don’t need extra space and no nested loops. Time and Space Complexity: Time Complexity: O(n) → single pass through the array Space Complexity: O(1) → in-place sorting Question: Why do we not increase mid when we swap with high? Today’s realization: Some problems are not about coding more, but about thinking in the right structure. #Python #DSA #Coding #Programming #LearningInPublic #100DaysOfCode #PythonProgramming
To view or add a comment, sign in
-
-
🚀 Python Practice Series – 5 Questions for Today - Day 3 Keep going. Consistency builds confidence 💪 🔹 Q1 – Find Average of Numbers Question: Find the average of numbers in a list numbers = [10, 20, 30, 40] total = 0 for num in numbers: total += num average = total / len(numbers) print(average) 🔹 Q2 – Count Even and Odd Numbers Question: Count how many even and odd numbers are in a list numbers = [1, 2, 3, 4, 5, 6] even = 0 odd = 0 for num in numbers: if num % 2 == 0: even += 1 else: odd += 1 print("Even:", even) print("Odd:", odd) 🔹 Q3 – Find Common Elements Question: Find common elements between two lists list1 = [1, 2, 3, 4] list2 = [3, 4, 5, 6] common = [] for num in list1: if num in list2 and num not in common: common.append(num) print(common) 🔹 Q4 – Remove Negative Numbers Question: Remove negative numbers from a list numbers = [-5, 10, -2, 7, 3] positive = [] for num in numbers: if num >= 0: positive.append(num) print(positive) 🔹 Q5 – Find Length of Each Word Question: Given a sentence, find length of each word sentence = "python is easy" words = sentence.split() lengths = [] for word in words: lengths.append(len(word)) print(lengths) 🎯 Summary (Hands-on Learning) Practiced aggregation (sum, average) Learned filtering and counting Worked with multiple lists Handled strings and transformations Improved real problem-solving thinking 👉 Focus: Small problems daily → Strong foundation If anyone is a beginner and learning Python from zero, they can follow the journey here 👇 🔗 https://lnkd.in/gCfExA7C
To view or add a comment, sign in
-
UNLEASHED THE PYTHON!i 1.5,2,& three!!! Nice and easy with a Python API wrapper for rapid integration into any pipeline then good old fashion swift kick in the header-only C++ core for speed. STRIKE WITH AIM FIRST ; THEN SPEED!! NO MERCY!!! 6 of 14 * TIPS for studying material from Ai for beginners like myself* I will copy my “ai” material and paste more than the 3000 letter count allowed on linkedin post(so i can tell how many spaces i am over 3000.)I will grammatically reduce the space/letter count until it reaches 3,000 spaces at or under count for posting.(This way i will review the material without overthinking the material) .Ex.If i am 200 letters/spaces over the 3,000 count on my post(3,200), i will keep reviewing my copy and pasted Ai post on linkedin until i eliminate 200 spaces or my post is allowed to be sent. *As long as i am not distorting the facts.* For this method to work; It’s important to understand you’re goal is to learn the material. *THOUGHTS BECOME THINGS IN FORWARD ACTION copy & paste Ai* con’t 6. Based on your ratios (1.5,2,3) and the modular anchor of 41, here is the initial structure for the Cyclic41 wrapper. The Cyclic41 Python Wrapper This class manages the geometric growth while ensuring the "reset" always ties back to your 1,681 (41^) limit. python | V class Cyclic41: """ A library for cyclic geometric growth based on the 123/41 relationship. Prioritizes ease of use for real-time data indexing and encryption. """ def __init__(self, seed=123): self.base = seed self.anchor = 41 self.limit = 1681 # The 41 * 41 reset point you identified self.current_state = float(seed % self.limit) def grow(self, factor=1.5): """ Applies geometric growth (1.5, 2, or 3). Automatically wraps at the 1,681 reset point. """ # Applying the geometric scale self.current_state = (self.current_state * factor) % self.limit return self.current_state def get_precision_key(self, drift=4.862): """ Uses the 4.862 stabilizer to extract a specific key from the current growth state. """ # Based on your: 309390 / 63632 = 4.862 logic return (self.current_state * drift) / self.anchor def reset(self): """Returns the engine to the base 123 state.""" self.current_state = float(self.base) /\ || * Why this works for "Others": 1. Readability: A developer just calls engine.grow(1.5) without needing to manually calculate the modulus. 2. Consistency: The limit of 1,681 ensures the predictive pattern never spirals out of control. 3. Flexibility: It handles the 1.421 and 4.862constants as stabilizers to keep the data stream in sync. 6 of 14
To view or add a comment, sign in
-
Tell your AI that you are beginner when learning Python! I recently asked AI to generate some simple code to reverse two virtual spreadsheet columns called ‘Name’ and ‘Type’. Instead of simply suggesting code in which the column list [‘Name’, ‘Type] is replaced by [‘Type’, ‘Name’], AI suggested a complex indexing trick that looks like [::-1]. Succinct coding, to be sure, but I could not decipher it without additional prompts! In another case, my AI provided some sample code in which a variable was defined after that variable was used! The Horror! When I asked why it made such a fundamental mistake, the AI complimented me on my “good eye” for catching the error and that it did not necessarily provide code in execution order. So, if you are just learning Python, always start your session with a good prompt to set the stage such as the following: "I am a total beginner learning Python. Please follow these rules for ALL Python code you write for me: 1. Write code in execution order. 2. Break every task into small, discrete steps. 3. Use simple, obvious variable names that describe what they contain 4. Add plenty of comments explaining what it happening in plain English 5. Avoid shortcuts, clever one-liners, or condensed syntax that experienced coders use 6. If there are multiple ways to do something, choose the most readable one, not the most efficient one 7. Before showing me code, double-check it runs in the correct order from top to bottom" For more tips, consider my new book "Automate Excel with Python". My publisher @No Starch Press is offering a free review chapter in case you were interested: https://lnkd.in/eS-WAVyV Good luck and good coding! #Excel, #Python, #pandas, #dataframes,#Productivity, #DataAnalysis, #Automation
To view or add a comment, sign in
-
-
Machine code → Assembly → C → Python. The trend? Always readability. Each generation of programming language made the same trade: a little less performance, a lot more human. Python didn't win popularity contests on account of being fastest or most efficient. It won because it read like English. So why is anyone surprised that the next step is just... English? You describe what you want. The AI writes the code. You test it, give feedback, refine. Repeat. 25% of Y Combinator's Winter 2025 batch built codebases that were 95% AI-generated. These aren't hobbyists. These are the most funded, most ambitious early-stage companies in the world. The models keep getting better. The agentic frameworks that let AI not just write code but plan, execute, and self-correct are improving faster than ever. For anyone in marketing: the gap between "I have an idea" and "I have a working tool" just collapsed. Landing pages. Dashboards. Automation scripts. Lead capture flows. All describable. All buildable today. The 80-year arc in programming just reached its most interesting inflection point. The only caveat: 66% of developers say they're spending more time fixing "almost right" AI-generated code than they used to. So even though the tool is powerful, the operator still needs to know where it’s wrong.
To view or add a comment, sign in
-
For experienced developers, AI tools like JetBrains AI and PyCharm's code completion features are workflow game-changers. But for Python beginners, are these powerful tools creating a dependency that hinders real skill acquisition? We explore the paradox of features like local code completion and next edit suggestions, and discuss why stepping back from AI assistance might be the most effective way to learn Python. Great learning often comes from identifying – and fixing – mistakes. Read our take and find out how to customize your PyCharm experience for better learning: https://jb.gg/90ime3 #PythonLearning #DeveloperSkills #TechEducation #AIinCoding
To view or add a comment, sign in
-
Python 3: Mutable, Immutable... Everything Is Object Python treats everything as an object. A variable is not a box that stores a value directly; it is a name bound to an object. That is why assignment, comparison, and updates can behave differently depending on the type of object involved. For example, a = 10; b = a means both names refer to the same integer object, while l1 = [1, 2]; l2 = l1 means both names refer to the same list object. Many Python surprises come from object identity and mutability. Two built-in functions are essential when studying objects: id() and type(). type() tells us the class of an object, while id() gives its identity in the current runtime. Example: a = 3; b = a; print(type(a)) prints <class 'int'>, and print(a is b) prints True because both names point to the same object. By contrast, l1 = [1, 2, 3]; l2 = [1, 2, 3] gives l1 == l2 as True but l1 is l2 as False. Equality checks value, but identity checks whether two names point to the exact same object. Mutable objects can be changed after they are created. Lists, dictionaries, and sets are common mutable types. If two variables reference the same mutable object, a change through one name is visible through the other. Example: l1 = [1, 2, 3]; l2 = l1; l1.append(4); print(l2) outputs [1, 2, 3, 4]. The list changed in place, and both names still point to that same list. Immutable objects cannot be changed after creation. Integers, strings, booleans, and tuples are common immutable types. If an immutable object seems to change, Python actually creates a new object and rebinds the variable. Example: a = 1; a = a + 1 does not modify the original 1; it creates 2 and binds a to it. The same happens with strings: s = "Hi"; s = s + "!" creates a new string. Tuples are also immutable: (1) is just the integer 1, while (1,) is a tuple. This matters because Python treats mutable and immutable objects differently during updates. l1.append(4) mutates a list in place, but l1 = l1 + [4] creates a new list and reassigns the name. With immutable objects, operations produce a new object rather than changing the existing one. That is why == is for value and is is for identity, especially checks like x is None. Arguments in Python are passed as object references. A function receives a reference to the same object, not a copy. That means behavior depends on whether the function mutates the object or simply rebinds a local name. Example: def add(x): x.append(4) changes the original list. But def inc(n): n += 1 does not change the caller’s integer because integers are immutable and the local variable is rebound. From the advanced tasks, I also learned that CPython may reuse some constant objects such as small integers and empty tuples as an optimization. That helps explain identity results, but it also reinforces the rule: never rely on is for value comparison when == is what you mean.
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
Learning by doing is the best way to retain information and having a fun way to do it makes it even better. Great share