Edit the Python example below and click Run to execute it and see the output.
Python Tutorial
Learn Python Tutorial with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
score = 86 | Assigns a value. |
print(f"{name} passed with {score}") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python HOME
Learn Python HOME with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
score = 86 | Assigns a value. |
print(f"{name} passed with {score}") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Intro
Learn Python Intro with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
score = 86 | Assigns a value. |
print(f"{name} passed with {score}") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Get Started
Learn Python Get Started with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
score = 86 | Assigns a value. |
print(f"{name} passed with {score}") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Syntax
Learn Python Syntax with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
score = 82 | Assigns a value. |
if score >= 50: | Conditional branch. |
print("Pass") | Outputs text to stdout. |
else: | Conditional branch. |
print("Fail") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Output
Learn Python Output with a small example you can edit and run.
print('Hello')
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Comments
Learn Python Comments with a small example you can edit and run.
# single-line comment
"""multi-line docstring"""
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
score = 82 | Assigns a value. |
if score >= 50: | Conditional branch. |
print("Pass") | Outputs text to stdout. |
else: | Conditional branch. |
print("Fail") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Variables
Learn Python Variables with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
age = 18 | Assigns a value. |
is_active = True | Assigns a value. |
nothing = None | Assigns a value. |
print(type(name), type(age), type(is_active), type(nothing)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Data Types
Learn Python Data Types with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
age = 18 | Assigns a value. |
is_active = True | Assigns a value. |
nothing = None | Assigns a value. |
print(type(name), type(age), type(is_active), type(nothing)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Numbers
Learn Python Numbers with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
a = 7 | Assigns a value. |
b = 3 | Assigns a value. |
print("a+b =", a + b) | Outputs text to stdout. |
print("a//b =", a // b) | Outputs text to stdout. |
print("float('3.14') =", float('3.14')) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Casting
Learn Python Casting with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
a = 7 | Assigns a value. |
b = 3 | Assigns a value. |
print("a+b =", a + b) | Outputs text to stdout. |
print("a//b =", a // b) | Outputs text to stdout. |
print("float('3.14') =", float('3.14')) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Strings
Learn Python Strings with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
streak = 7 | Assigns a value. |
print(f"{name} has a {streak}-day streak") | Outputs text to stdout. |
print(name.upper()) | Outputs text to stdout. |
print(name[0:2]) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Booleans
Learn Python Booleans with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
score = 72 | Assigns a value. |
if score >= 75: | Conditional branch. |
result = "Pass" | Assigns a value. |
elif score >= 50: | Conditional branch. |
result = "Retry" | Assigns a value. |
else: | Conditional branch. |
result = "Fail" | Assigns a value. |
print(result) | Outputs text to stdout. |
for i in range(1, 4): | Loop: repeats code. |
print("i =", i) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Operators
Learn Python Operators with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
a = 7 | Assigns a value. |
b = 3 | Assigns a value. |
print("a+b =", a + b) | Outputs text to stdout. |
print("a//b =", a // b) | Outputs text to stdout. |
print("float('3.14') =", float('3.14')) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Lists
Learn Python Lists with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [1, 2, 2, 3] | Assigns a value. |
print("list:", nums) | Outputs text to stdout. |
print("unique set:", set(nums)) | Outputs text to stdout. |
user = {"name": "Mana", "level": 2} | Assigns a value. |
user["level"] += 1 | Assigns a value. |
print("dict:", user) | Outputs text to stdout. |
- 1Store and transform collections (filtering, grouping).
- 2Use dicts for fast lookups.
- 1Mutating lists unintentionally.
- 2Using a list where a set/dict would be faster.
- 1Choose the right container: list vs set vs dict.
- 2Keep data transformations clear and readable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Tuples
Learn Python Tuples with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [1, 2, 2, 3] | Assigns a value. |
print("list:", nums) | Outputs text to stdout. |
print("unique set:", set(nums)) | Outputs text to stdout. |
user = {"name": "Mana", "level": 2} | Assigns a value. |
user["level"] += 1 | Assigns a value. |
print("dict:", user) | Outputs text to stdout. |
- 1Store and transform collections (filtering, grouping).
- 2Use dicts for fast lookups.
- 1Mutating lists unintentionally.
- 2Using a list where a set/dict would be faster.
- 1Choose the right container: list vs set vs dict.
- 2Keep data transformations clear and readable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Sets
Learn Python Sets with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [1, 2, 2, 3] | Assigns a value. |
print("list:", nums) | Outputs text to stdout. |
print("unique set:", set(nums)) | Outputs text to stdout. |
user = {"name": "Mana", "level": 2} | Assigns a value. |
user["level"] += 1 | Assigns a value. |
print("dict:", user) | Outputs text to stdout. |
- 1Store and transform collections (filtering, grouping).
- 2Use dicts for fast lookups.
- 1Mutating lists unintentionally.
- 2Using a list where a set/dict would be faster.
- 1Choose the right container: list vs set vs dict.
- 2Keep data transformations clear and readable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Dictionaries
Learn Python Dictionaries with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [1, 2, 2, 3] | Assigns a value. |
print("list:", nums) | Outputs text to stdout. |
print("unique set:", set(nums)) | Outputs text to stdout. |
user = {"name": "Mana", "level": 2} | Assigns a value. |
user["level"] += 1 | Assigns a value. |
print("dict:", user) | Outputs text to stdout. |
- 1Store and transform collections (filtering, grouping).
- 2Use dicts for fast lookups.
- 1Mutating lists unintentionally.
- 2Using a list where a set/dict would be faster.
- 1Choose the right container: list vs set vs dict.
- 2Keep data transformations clear and readable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python If...Else
Learn Python If...Else with a small example you can edit and run.
if condition:
...
elif other:
...
else:
...
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
score = 72 | Assigns a value. |
if score >= 75: | Conditional branch. |
result = "Pass" | Assigns a value. |
elif score >= 50: | Conditional branch. |
result = "Retry" | Assigns a value. |
else: | Conditional branch. |
result = "Fail" | Assigns a value. |
print(result) | Outputs text to stdout. |
for i in range(1, 4): | Loop: repeats code. |
print("i =", i) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Match
Learn Python Match with a small example you can edit and run.
if condition:
...
elif other:
...
else:
...
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
status = 404 | Assigns a value. |
if status == 200: | Conditional branch. |
msg = "OK" | Assigns a value. |
elif status == 404: | Conditional branch. |
msg = "Not Found" | Assigns a value. |
else: | Conditional branch. |
msg = "Other" | Assigns a value. |
print(msg) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python While Loops
Learn Python While Loops with a small example you can edit and run.
for x in items:
...
while condition:
...
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
score = 72 | Assigns a value. |
if score >= 75: | Conditional branch. |
result = "Pass" | Assigns a value. |
elif score >= 50: | Conditional branch. |
result = "Retry" | Assigns a value. |
else: | Conditional branch. |
result = "Fail" | Assigns a value. |
print(result) | Outputs text to stdout. |
for i in range(1, 4): | Loop: repeats code. |
print("i =", i) | Outputs text to stdout. |
- 1Model domain objects (User, Order, Product).
- 2Organize larger projects into reusable components.
- 1Overusing classes for simple scripts.
- 2Forgetting `self` as the first parameter in methods.
- 1Start with functions; add classes when you need state + behavior.
- 2Use type hints for readability.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python For Loops
Learn Python For Loops with a small example you can edit and run.
for x in items:
...
while condition:
...
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
score = 72 | Assigns a value. |
if score >= 75: | Conditional branch. |
result = "Pass" | Assigns a value. |
elif score >= 50: | Conditional branch. |
result = "Retry" | Assigns a value. |
else: | Conditional branch. |
result = "Fail" | Assigns a value. |
print(result) | Outputs text to stdout. |
for i in range(1, 4): | Loop: repeats code. |
print("i =", i) | Outputs text to stdout. |
- 1Model domain objects (User, Order, Product).
- 2Organize larger projects into reusable components.
- 1Overusing classes for simple scripts.
- 2Forgetting `self` as the first parameter in methods.
- 1Start with functions; add classes when you need state + behavior.
- 2Use type hints for readability.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Functions
Learn Python Functions with a small example you can edit and run.
def name(arg):
return value
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
def greet(name: str) -> str: | Defines a function. |
return f"Hello, {name}!" | Python statement. |
print(greet("Developer")) | Outputs text to stdout. |
nums = [1, 2, 3] | Assigns a value. |
for x in nums: | Loop: repeats code. |
print(x) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Range
Learn Python Range with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
score = 72 | Assigns a value. |
if score >= 75: | Conditional branch. |
result = "Pass" | Assigns a value. |
elif score >= 50: | Conditional branch. |
result = "Retry" | Assigns a value. |
else: | Conditional branch. |
result = "Fail" | Assigns a value. |
print(result) | Outputs text to stdout. |
for i in range(1, 4): | Loop: repeats code. |
print("i =", i) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Arrays
Learn Python Arrays with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [1, 2, 2, 3] | Assigns a value. |
print("list:", nums) | Outputs text to stdout. |
print("unique set:", set(nums)) | Outputs text to stdout. |
user = {"name": "Mana", "level": 2} | Assigns a value. |
user["level"] += 1 | Assigns a value. |
print("dict:", user) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Iterators
Learn Python Iterators with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
def greet(name: str) -> str: | Defines a function. |
return f"Hello, {name}!" | Python statement. |
print(greet("Developer")) | Outputs text to stdout. |
nums = [1, 2, 3] | Assigns a value. |
for x in nums: | Loop: repeats code. |
print(x) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Modules
Learn Python Modules with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use venv + pip for clean environments") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Dates
Learn Python Dates with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
from datetime import datetime | Imports a module. |
now = datetime.now() | Assigns a value. |
print(now.strftime("%Y-%m-%d %H:%M")) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Math
Learn Python Math with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
a = 7 | Assigns a value. |
b = 3 | Assigns a value. |
print("a+b =", a + b) | Outputs text to stdout. |
print("a//b =", a // b) | Outputs text to stdout. |
print("float('3.14') =", float('3.14')) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python JSON
Learn Python JSON with a small example you can edit and run.
import json
json.dumps(obj)
json.loads(s)
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
import json | Imports a module. |
obj = {"ok": True, "count": 3} | Assigns a value. |
s = json.dumps(obj) | Assigns a value. |
print(s) | Outputs text to stdout. |
print(json.loads(s)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python RegEx
Learn Python RegEx with a small example you can edit and run.
import re
re.search(r'pattern', text)
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
import re | Imports a module. |
text = "email: test@example.com" | Assigns a value. |
m = re.search(r"[\w.-]+@[\w.-]+", text) | Assigns a value. |
print(m.group(0) if m else "no match") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python PIP
Learn Python PIP with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use venv + pip for clean environments") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Try...Except
Learn Python Try...Except with a small example you can edit and run.
try:
...
except Exception as e:
...
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
int("not-a-number") | Python statement. |
except ValueError as e: | Error handling block. |
print("Error:", e) | Outputs text to stdout. |
- 1Handle invalid user input and network failures gracefully.
- 2Wrap risky parsing with clear errors.
- 1Catching bare `except:` and hiding bugs.
- 2Swallowing errors without logging.
- 1Catch specific exceptions (ValueError, KeyError, etc.).
- 2Log context when something fails.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python String Formatting
Learn Python String Formatting with a small example you can edit and run.
for x in items:
...
while condition:
...
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
score = 86 | Assigns a value. |
print(f"{name} scored {score}") | Outputs text to stdout. |
print("{} scored {}".format(name, score)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python None
Learn Python None with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
age = 18 | Assigns a value. |
is_active = True | Assigns a value. |
nothing = None | Assigns a value. |
print(type(name), type(age), type(is_active), type(nothing)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python User Input
Learn Python User Input with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python VirtualEnv
Learn Python VirtualEnv with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use venv + pip for clean environments") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Classes
Learn Python Classes with a small example you can edit and run.
class Name:
def __init__(self):
...
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
class User: | Defines a class. |
def __init__(self, name: str): | Defines a function. |
self.name = name | Assigns a value. |
def greet(self) -> str: | Defines a function. |
return f"Hi, I am {self.name}" | Python statement. |
u = User("Mana") | Assigns a value. |
print(u.greet()) | Outputs text to stdout. |
- 1Model domain objects (User, Order, Product).
- 2Organize larger projects into reusable components.
- 1Overusing classes for simple scripts.
- 2Forgetting `self` as the first parameter in methods.
- 1Start with functions; add classes when you need state + behavior.
- 2Use type hints for readability.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python OOP
Learn Python OOP with a small example you can edit and run.
class Name:
def __init__(self):
...
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
class User: | Defines a class. |
def __init__(self, name: str): | Defines a function. |
self.name = name | Assigns a value. |
def greet(self) -> str: | Defines a function. |
return f"Hi, I am {self.name}" | Python statement. |
u = User("Mana") | Assigns a value. |
print(u.greet()) | Outputs text to stdout. |
- 1Model domain objects (User, Order, Product).
- 2Organize larger projects into reusable components.
- 1Overusing classes for simple scripts.
- 2Forgetting `self` as the first parameter in methods.
- 1Start with functions; add classes when you need state + behavior.
- 2Use type hints for readability.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Classes/Objects
Learn Python Classes/Objects with a small example you can edit and run.
class Name:
def __init__(self):
...
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
class User: | Defines a class. |
def __init__(self, name: str): | Defines a function. |
self.name = name | Assigns a value. |
def greet(self) -> str: | Defines a function. |
return f"Hi, I am {self.name}" | Python statement. |
u = User("Mana") | Assigns a value. |
print(u.greet()) | Outputs text to stdout. |
- 1Model domain objects (User, Order, Product).
- 2Organize larger projects into reusable components.
- 1Overusing classes for simple scripts.
- 2Forgetting `self` as the first parameter in methods.
- 1Start with functions; add classes when you need state + behavior.
- 2Use type hints for readability.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python __init__ Method
Learn Python __init__ Method with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python self Parameter
Learn Python self Parameter with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Class Properties
Learn Python Class Properties with a small example you can edit and run.
class Name:
def __init__(self):
...
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
class User: | Defines a class. |
def __init__(self, name: str): | Defines a function. |
self.name = name | Assigns a value. |
def greet(self) -> str: | Defines a function. |
return f"Hi, I am {self.name}" | Python statement. |
u = User("Mana") | Assigns a value. |
print(u.greet()) | Outputs text to stdout. |
- 1Model domain objects (User, Order, Product).
- 2Organize larger projects into reusable components.
- 1Overusing classes for simple scripts.
- 2Forgetting `self` as the first parameter in methods.
- 1Start with functions; add classes when you need state + behavior.
- 2Use type hints for readability.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Class Methods
Learn Python Class Methods with a small example you can edit and run.
class Name:
def __init__(self):
...
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
class User: | Defines a class. |
def __init__(self, name: str): | Defines a function. |
self.name = name | Assigns a value. |
def greet(self) -> str: | Defines a function. |
return f"Hi, I am {self.name}" | Python statement. |
u = User("Mana") | Assigns a value. |
print(u.greet()) | Outputs text to stdout. |
- 1Model domain objects (User, Order, Product).
- 2Organize larger projects into reusable components.
- 1Overusing classes for simple scripts.
- 2Forgetting `self` as the first parameter in methods.
- 1Start with functions; add classes when you need state + behavior.
- 2Use type hints for readability.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Inheritance
Learn Python Inheritance with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
class User: | Defines a class. |
def __init__(self, name: str): | Defines a function. |
self.name = name | Assigns a value. |
def greet(self) -> str: | Defines a function. |
return f"Hi, I am {self.name}" | Python statement. |
u = User("Mana") | Assigns a value. |
print(u.greet()) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Polymorphism
Learn Python Polymorphism with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
class User: | Defines a class. |
def __init__(self, name: str): | Defines a function. |
self.name = name | Assigns a value. |
def greet(self) -> str: | Defines a function. |
return f"Hi, I am {self.name}" | Python statement. |
u = User("Mana") | Assigns a value. |
print(u.greet()) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Encapsulation
Learn Python Encapsulation with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
class User: | Defines a class. |
def __init__(self, name: str): | Defines a function. |
self.name = name | Assigns a value. |
def greet(self) -> str: | Defines a function. |
return f"Hi, I am {self.name}" | Python statement. |
u = User("Mana") | Assigns a value. |
print(u.greet()) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Inner Classes
Learn Python Inner Classes with a small example you can edit and run.
class Name:
def __init__(self):
...
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
class User: | Defines a class. |
def __init__(self, name: str): | Defines a function. |
self.name = name | Assigns a value. |
def greet(self) -> str: | Defines a function. |
return f"Hi, I am {self.name}" | Python statement. |
u = User("Mana") | Assigns a value. |
print(u.greet()) | Outputs text to stdout. |
- 1Model domain objects (User, Order, Product).
- 2Organize larger projects into reusable components.
- 1Overusing classes for simple scripts.
- 2Forgetting `self` as the first parameter in methods.
- 1Start with functions; add classes when you need state + behavior.
- 2Use type hints for readability.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
File Handling
Learn File Handling with a small example you can edit and run.
with open('file.txt', 'r', encoding='utf-8') as f:
data = f.read()
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
path = "demo.txt" | Assigns a value. |
with open(path, "w", encoding="utf-8") as f: | Context manager (ensures cleanup). |
f.write("Hello file\n") | Python statement. |
with open(path, "r", encoding="utf-8") as f: | Context manager (ensures cleanup). |
print(f.read()) | Outputs text to stdout. |
- 1Read configuration files and write reports/logs.
- 2Process CSV/text files in automation.
- 1Forgetting to close files (fixed by `with open(...)`).
- 2Mixing encodings and getting weird characters.
- 1Always use `with open(..., encoding=\"utf-8\")`.
- 2Keep file paths configurable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python File Handling
Learn Python File Handling with a small example you can edit and run.
with open('file.txt', 'r', encoding='utf-8') as f:
data = f.read()
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
path = "demo.txt" | Assigns a value. |
with open(path, "w", encoding="utf-8") as f: | Context manager (ensures cleanup). |
f.write("Hello file\n") | Python statement. |
with open(path, "r", encoding="utf-8") as f: | Context manager (ensures cleanup). |
print(f.read()) | Outputs text to stdout. |
- 1Read configuration files and write reports/logs.
- 2Process CSV/text files in automation.
- 1Forgetting to close files (fixed by `with open(...)`).
- 2Mixing encodings and getting weird characters.
- 1Always use `with open(..., encoding=\"utf-8\")`.
- 2Keep file paths configurable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Read Files
Learn Python Read Files with a small example you can edit and run.
with open('file.txt', 'r', encoding='utf-8') as f:
data = f.read()
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
path = "demo.txt" | Assigns a value. |
with open(path, "w", encoding="utf-8") as f: | Context manager (ensures cleanup). |
f.write("Hello file\n") | Python statement. |
with open(path, "r", encoding="utf-8") as f: | Context manager (ensures cleanup). |
print(f.read()) | Outputs text to stdout. |
- 1Read configuration files and write reports/logs.
- 2Process CSV/text files in automation.
- 1Forgetting to close files (fixed by `with open(...)`).
- 2Mixing encodings and getting weird characters.
- 1Always use `with open(..., encoding=\"utf-8\")`.
- 2Keep file paths configurable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Write/Create Files
Learn Python Write/Create Files with a small example you can edit and run.
with open('file.txt', 'r', encoding='utf-8') as f:
data = f.read()
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
path = "demo.txt" | Assigns a value. |
with open(path, "w", encoding="utf-8") as f: | Context manager (ensures cleanup). |
f.write("Hello file\n") | Python statement. |
with open(path, "r", encoding="utf-8") as f: | Context manager (ensures cleanup). |
print(f.read()) | Outputs text to stdout. |
- 1Read configuration files and write reports/logs.
- 2Process CSV/text files in automation.
- 1Forgetting to close files (fixed by `with open(...)`).
- 2Mixing encodings and getting weird characters.
- 1Always use `with open(..., encoding=\"utf-8\")`.
- 2Keep file paths configurable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Delete Files
Learn Python Delete Files with a small example you can edit and run.
with open('file.txt', 'r', encoding='utf-8') as f:
data = f.read()
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
path = "demo.txt" | Assigns a value. |
with open(path, "w", encoding="utf-8") as f: | Context manager (ensures cleanup). |
f.write("Hello file\n") | Python statement. |
with open(path, "r", encoding="utf-8") as f: | Context manager (ensures cleanup). |
print(f.read()) | Outputs text to stdout. |
- 1Read configuration files and write reports/logs.
- 2Process CSV/text files in automation.
- 1Forgetting to close files (fixed by `with open(...)`).
- 2Mixing encodings and getting weird characters.
- 1Always use `with open(..., encoding=\"utf-8\")`.
- 2Keep file paths configurable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Modules (Modules & Frameworks)
Learn Python Modules (Modules & Frameworks) with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use venv + pip for clean environments") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
NumPy Tutorial
Learn NumPy Tutorial with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
score = 86 | Assigns a value. |
print(f"{name} passed with {score}") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Pandas Tutorial
Learn Pandas Tutorial with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
score = 86 | Assigns a value. |
print(f"{name} passed with {score}") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
SciPy Tutorial
Learn SciPy Tutorial with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
score = 86 | Assigns a value. |
print(f"{name} passed with {score}") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Django Tutorial
Learn Django Tutorial with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
score = 86 | Assigns a value. |
print(f"{name} passed with {score}") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Matplotlib
Learn Python Matplotlib with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
import matplotlib | Imports a module. |
print("matplotlib version:", matplotlib.__version__) | Outputs text to stdout. |
except Exception: | Error handling block. |
print("Matplotlib may not be installed in this environment.") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Matplotlib Intro
Learn Matplotlib Intro with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
score = 86 | Assigns a value. |
print(f"{name} passed with {score}") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Matplotlib Get Started
Learn Matplotlib Get Started with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
score = 86 | Assigns a value. |
print(f"{name} passed with {score}") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Matplotlib Pyplot
Learn Matplotlib Pyplot with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
import matplotlib | Imports a module. |
print("matplotlib version:", matplotlib.__version__) | Outputs text to stdout. |
except Exception: | Error handling block. |
print("Matplotlib may not be installed in this environment.") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Matplotlib Plotting
Learn Matplotlib Plotting with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
import matplotlib | Imports a module. |
print("matplotlib version:", matplotlib.__version__) | Outputs text to stdout. |
except Exception: | Error handling block. |
print("Matplotlib may not be installed in this environment.") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Matplotlib Markers
Learn Matplotlib Markers with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
import matplotlib | Imports a module. |
print("matplotlib version:", matplotlib.__version__) | Outputs text to stdout. |
except Exception: | Error handling block. |
print("Matplotlib may not be installed in this environment.") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Matplotlib Line
Learn Matplotlib Line with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
import matplotlib | Imports a module. |
print("matplotlib version:", matplotlib.__version__) | Outputs text to stdout. |
except Exception: | Error handling block. |
print("Matplotlib may not be installed in this environment.") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Matplotlib Labels
Learn Matplotlib Labels with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
import matplotlib | Imports a module. |
print("matplotlib version:", matplotlib.__version__) | Outputs text to stdout. |
except Exception: | Error handling block. |
print("Matplotlib may not be installed in this environment.") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Matplotlib Grid
Learn Matplotlib Grid with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
import matplotlib | Imports a module. |
print("matplotlib version:", matplotlib.__version__) | Outputs text to stdout. |
except Exception: | Error handling block. |
print("Matplotlib may not be installed in this environment.") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Matplotlib Subplot
Learn Matplotlib Subplot with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
import matplotlib | Imports a module. |
print("matplotlib version:", matplotlib.__version__) | Outputs text to stdout. |
except Exception: | Error handling block. |
print("Matplotlib may not be installed in this environment.") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Matplotlib Scatter
Learn Matplotlib Scatter with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
import matplotlib | Imports a module. |
print("matplotlib version:", matplotlib.__version__) | Outputs text to stdout. |
except Exception: | Error handling block. |
print("Matplotlib may not be installed in this environment.") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Matplotlib Bars
Learn Matplotlib Bars with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
import matplotlib | Imports a module. |
print("matplotlib version:", matplotlib.__version__) | Outputs text to stdout. |
except Exception: | Error handling block. |
print("Matplotlib may not be installed in this environment.") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Matplotlib Histograms
Learn Matplotlib Histograms with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
import matplotlib | Imports a module. |
print("matplotlib version:", matplotlib.__version__) | Outputs text to stdout. |
except Exception: | Error handling block. |
print("Matplotlib may not be installed in this environment.") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Matplotlib Pie Charts
Learn Matplotlib Pie Charts with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
import matplotlib | Imports a module. |
print("matplotlib version:", matplotlib.__version__) | Outputs text to stdout. |
except Exception: | Error handling block. |
print("Matplotlib may not be installed in this environment.") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Machine Learning
Learn Machine Learning with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
from statistics import mean, median | Imports a module. |
nums = [1, 2, 2, 3, 9] | Assigns a value. |
print("mean:", mean(nums)) | Outputs text to stdout. |
print("median:", median(nums)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Getting Started
Learn Getting Started with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Mean Median Mode
Learn Mean Median Mode with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
from statistics import mean, median | Imports a module. |
nums = [1, 2, 2, 3, 9] | Assigns a value. |
print("mean:", mean(nums)) | Outputs text to stdout. |
print("median:", median(nums)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Standard Deviation
Learn Standard Deviation with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
from statistics import mean, median | Imports a module. |
nums = [1, 2, 2, 3, 9] | Assigns a value. |
print("mean:", mean(nums)) | Outputs text to stdout. |
print("median:", median(nums)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Percentile
Learn Percentile with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
from statistics import mean, median | Imports a module. |
nums = [1, 2, 2, 3, 9] | Assigns a value. |
print("mean:", mean(nums)) | Outputs text to stdout. |
print("median:", median(nums)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Data Distribution
Learn Data Distribution with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Normal Data Distribution
Learn Normal Data Distribution with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Scatter Plot
Learn Scatter Plot with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Linear Regression
Learn Linear Regression with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
from statistics import mean, median | Imports a module. |
nums = [1, 2, 2, 3, 9] | Assigns a value. |
print("mean:", mean(nums)) | Outputs text to stdout. |
print("median:", median(nums)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Polynomial Regression
Learn Polynomial Regression with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
from statistics import mean, median | Imports a module. |
nums = [1, 2, 2, 3, 9] | Assigns a value. |
print("mean:", mean(nums)) | Outputs text to stdout. |
print("median:", median(nums)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Multiple Regression
Learn Multiple Regression with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
from statistics import mean, median | Imports a module. |
nums = [1, 2, 2, 3, 9] | Assigns a value. |
print("mean:", mean(nums)) | Outputs text to stdout. |
print("median:", median(nums)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Scale
Learn Scale with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Train/Test
Learn Train/Test with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Decision Tree
Learn Decision Tree with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Confusion Matrix
Learn Confusion Matrix with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Hierarchical Clustering
Learn Hierarchical Clustering with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Logistic Regression
Learn Logistic Regression with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
from statistics import mean, median | Imports a module. |
nums = [1, 2, 2, 3, 9] | Assigns a value. |
print("mean:", mean(nums)) | Outputs text to stdout. |
print("median:", median(nums)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Grid Search
Learn Grid Search with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Categorical Data
Learn Categorical Data with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
K-means
Learn K-means with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
from statistics import mean, median | Imports a module. |
nums = [1, 2, 2, 3, 9] | Assigns a value. |
print("mean:", mean(nums)) | Outputs text to stdout. |
print("median:", median(nums)) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Bootstrap Aggregation
Learn Bootstrap Aggregation with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Cross Validation
Learn Cross Validation with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
AUC - ROC Curve
Learn AUC - ROC Curve with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
K-nearest neighbors
Learn K-nearest neighbors with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python DSA
Learn Python DSA with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Lists and Arrays
Learn Lists and Arrays with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [1, 2, 2, 3] | Assigns a value. |
print("list:", nums) | Outputs text to stdout. |
print("unique set:", set(nums)) | Outputs text to stdout. |
user = {"name": "Mana", "level": 2} | Assigns a value. |
user["level"] += 1 | Assigns a value. |
print("dict:", user) | Outputs text to stdout. |
- 1Store and transform collections (filtering, grouping).
- 2Use dicts for fast lookups.
- 1Mutating lists unintentionally.
- 2Using a list where a set/dict would be faster.
- 1Choose the right container: list vs set vs dict.
- 2Keep data transformations clear and readable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Stacks
Learn Stacks with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Queues
Learn Queues with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Linked Lists
Learn Linked Lists with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [1, 2, 2, 3] | Assigns a value. |
print("list:", nums) | Outputs text to stdout. |
print("unique set:", set(nums)) | Outputs text to stdout. |
user = {"name": "Mana", "level": 2} | Assigns a value. |
user["level"] += 1 | Assigns a value. |
print("dict:", user) | Outputs text to stdout. |
- 1Store and transform collections (filtering, grouping).
- 2Use dicts for fast lookups.
- 1Mutating lists unintentionally.
- 2Using a list where a set/dict would be faster.
- 1Choose the right container: list vs set vs dict.
- 2Keep data transformations clear and readable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Hash Tables
Learn Hash Tables with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Trees
Learn Trees with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Binary Trees
Learn Binary Trees with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Binary Search Trees
Learn Binary Search Trees with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
AVL Trees
Learn AVL Trees with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Graphs
Learn Graphs with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Linear Search
Learn Linear Search with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Binary Search
Learn Binary Search with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Bubble Sort
Learn Bubble Sort with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Selection Sort
Learn Selection Sort with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Insertion Sort
Learn Insertion Sort with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Quick Sort
Learn Quick Sort with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Counting Sort
Learn Counting Sort with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Radix Sort
Learn Radix Sort with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Merge Sort
Learn Merge Sort with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python MySQL
Learn Python MySQL with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MySQL Get Started
Learn MySQL Get Started with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
score = 86 | Assigns a value. |
print(f"{name} passed with {score}") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MySQL Create Database
Learn MySQL Create Database with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MySQL Create Table
Learn MySQL Create Table with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MySQL Insert
Learn MySQL Insert with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MySQL Select
Learn MySQL Select with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MySQL Where
Learn MySQL Where with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MySQL Order By
Learn MySQL Order By with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MySQL Delete
Learn MySQL Delete with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
path = "demo.txt" | Assigns a value. |
with open(path, "w", encoding="utf-8") as f: | Context manager (ensures cleanup). |
f.write("Hello file\n") | Python statement. |
with open(path, "r", encoding="utf-8") as f: | Context manager (ensures cleanup). |
print(f.read()) | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MySQL Drop Table
Learn MySQL Drop Table with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MySQL Update
Learn MySQL Update with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
from datetime import datetime | Imports a module. |
now = datetime.now() | Assigns a value. |
print(now.strftime("%Y-%m-%d %H:%M")) | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MySQL Limit
Learn MySQL Limit with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MySQL Join
Learn MySQL Join with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python MongoDB
Learn Python MongoDB with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MongoDB Get Started
Learn MongoDB Get Started with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
score = 86 | Assigns a value. |
print(f"{name} passed with {score}") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MongoDB Create DB
Learn MongoDB Create DB with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MongoDB Collection
Learn MongoDB Collection with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MongoDB Insert
Learn MongoDB Insert with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MongoDB Find
Learn MongoDB Find with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MongoDB Query
Learn MongoDB Query with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MongoDB Sort
Learn MongoDB Sort with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [3, 1, 4, 1, 5] | Assigns a value. |
target = 4 | Assigns a value. |
idx = -1 | Assigns a value. |
for i, x in enumerate(nums): | Loop: repeats code. |
if x == target: | Conditional branch. |
idx = i | Assigns a value. |
break | Python statement. |
print("found at", idx) | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MongoDB Delete
Learn MongoDB Delete with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
path = "demo.txt" | Assigns a value. |
with open(path, "w", encoding="utf-8") as f: | Context manager (ensures cleanup). |
f.write("Hello file\n") | Python statement. |
with open(path, "r", encoding="utf-8") as f: | Context manager (ensures cleanup). |
print(f.read()) | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MongoDB Drop Collection
Learn MongoDB Drop Collection with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MongoDB Update
Learn MongoDB Update with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
from datetime import datetime | Imports a module. |
now = datetime.now() | Assigns a value. |
print(now.strftime("%Y-%m-%d %H:%M")) | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
MongoDB Limit
Learn MongoDB Limit with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use a DB driver (mysql-connector / pymongo) in real projects") | Outputs text to stdout. |
- 1Read/write application data and build CRUD services.
- 2Use parameterized queries to avoid SQL injection.
- 1Hardcoding credentials in code.
- 2Building SQL via string concatenation.
- 1Use env vars for secrets.
- 2Use parameterized queries / ORM as appropriate.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Reference
Learn Python Reference with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Overview
Learn Python Overview with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Built-in Functions
Learn Python Built-in Functions with a small example you can edit and run.
def name(arg):
return value
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
def greet(name: str) -> str: | Defines a function. |
return f"Hello, {name}!" | Python statement. |
print(greet("Developer")) | Outputs text to stdout. |
nums = [1, 2, 3] | Assigns a value. |
for x in nums: | Loop: repeats code. |
print(x) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python String Methods
Learn Python String Methods with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
streak = 7 | Assigns a value. |
print(f"{name} has a {streak}-day streak") | Outputs text to stdout. |
print(name.upper()) | Outputs text to stdout. |
print(name[0:2]) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python List Methods
Learn Python List Methods with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [1, 2, 2, 3] | Assigns a value. |
print("list:", nums) | Outputs text to stdout. |
print("unique set:", set(nums)) | Outputs text to stdout. |
user = {"name": "Mana", "level": 2} | Assigns a value. |
user["level"] += 1 | Assigns a value. |
print("dict:", user) | Outputs text to stdout. |
- 1Store and transform collections (filtering, grouping).
- 2Use dicts for fast lookups.
- 1Mutating lists unintentionally.
- 2Using a list where a set/dict would be faster.
- 1Choose the right container: list vs set vs dict.
- 2Keep data transformations clear and readable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Dictionary Methods
Learn Python Dictionary Methods with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [1, 2, 2, 3] | Assigns a value. |
print("list:", nums) | Outputs text to stdout. |
print("unique set:", set(nums)) | Outputs text to stdout. |
user = {"name": "Mana", "level": 2} | Assigns a value. |
user["level"] += 1 | Assigns a value. |
print("dict:", user) | Outputs text to stdout. |
- 1Store and transform collections (filtering, grouping).
- 2Use dicts for fast lookups.
- 1Mutating lists unintentionally.
- 2Using a list where a set/dict would be faster.
- 1Choose the right container: list vs set vs dict.
- 2Keep data transformations clear and readable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Tuple Methods
Learn Python Tuple Methods with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [1, 2, 2, 3] | Assigns a value. |
print("list:", nums) | Outputs text to stdout. |
print("unique set:", set(nums)) | Outputs text to stdout. |
user = {"name": "Mana", "level": 2} | Assigns a value. |
user["level"] += 1 | Assigns a value. |
print("dict:", user) | Outputs text to stdout. |
- 1Store and transform collections (filtering, grouping).
- 2Use dicts for fast lookups.
- 1Mutating lists unintentionally.
- 2Using a list where a set/dict would be faster.
- 1Choose the right container: list vs set vs dict.
- 2Keep data transformations clear and readable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Set Methods
Learn Python Set Methods with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [1, 2, 2, 3] | Assigns a value. |
print("list:", nums) | Outputs text to stdout. |
print("unique set:", set(nums)) | Outputs text to stdout. |
user = {"name": "Mana", "level": 2} | Assigns a value. |
user["level"] += 1 | Assigns a value. |
print("dict:", user) | Outputs text to stdout. |
- 1Store and transform collections (filtering, grouping).
- 2Use dicts for fast lookups.
- 1Mutating lists unintentionally.
- 2Using a list where a set/dict would be faster.
- 1Choose the right container: list vs set vs dict.
- 2Keep data transformations clear and readable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python File Methods
Learn Python File Methods with a small example you can edit and run.
with open('file.txt', 'r', encoding='utf-8') as f:
data = f.read()
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
path = "demo.txt" | Assigns a value. |
with open(path, "w", encoding="utf-8") as f: | Context manager (ensures cleanup). |
f.write("Hello file\n") | Python statement. |
with open(path, "r", encoding="utf-8") as f: | Context manager (ensures cleanup). |
print(f.read()) | Outputs text to stdout. |
- 1Read configuration files and write reports/logs.
- 2Process CSV/text files in automation.
- 1Forgetting to close files (fixed by `with open(...)`).
- 2Mixing encodings and getting weird characters.
- 1Always use `with open(..., encoding=\"utf-8\")`.
- 2Keep file paths configurable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Keywords
Learn Python Keywords with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Exceptions
Learn Python Exceptions with a small example you can edit and run.
try:
...
except Exception as e:
...
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
try: | Error handling block. |
int("not-a-number") | Python statement. |
except ValueError as e: | Error handling block. |
print("Error:", e) | Outputs text to stdout. |
- 1Handle invalid user input and network failures gracefully.
- 2Wrap risky parsing with clear errors.
- 1Catching bare `except:` and hiding bugs.
- 2Swallowing errors without logging.
- 1Catch specific exceptions (ValueError, KeyError, etc.).
- 2Log context when something fails.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python Glossary
Learn Python Glossary with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Practice: edit this example") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Module Reference
Learn Module Reference with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use venv + pip for clean environments") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Built-in Modules
Learn Built-in Modules with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use venv + pip for clean environments") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Random Module
Learn Random Module with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use venv + pip for clean environments") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Requests Module
Learn Requests Module with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use venv + pip for clean environments") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Statistics Module
Learn Statistics Module with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
print("Use venv + pip for clean environments") | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Math Module
Learn Math Module with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
a = 7 | Assigns a value. |
b = 3 | Assigns a value. |
print("a+b =", a + b) | Outputs text to stdout. |
print("a//b =", a // b) | Outputs text to stdout. |
print("float('3.14') =", float('3.14')) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
cMath Module
Learn cMath Module with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
a = 7 | Assigns a value. |
b = 3 | Assigns a value. |
print("a+b =", a + b) | Outputs text to stdout. |
print("a//b =", a // b) | Outputs text to stdout. |
print("float('3.14') =", float('3.14')) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Python How To
Learn Python How To with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [1, 2, 2, 3] | Assigns a value. |
print(list(dict.fromkeys(nums))) # remove duplicates, keep order | Outputs text to stdout. |
s = "mana" | Assigns a value. |
print(s[::-1]) # reverse string | Outputs text to stdout. |
print(7 + 5) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Remove List Duplicates
Learn Remove List Duplicates with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
nums = [1, 2, 2, 3] | Assigns a value. |
print("list:", nums) | Outputs text to stdout. |
print("unique set:", set(nums)) | Outputs text to stdout. |
user = {"name": "Mana", "level": 2} | Assigns a value. |
user["level"] += 1 | Assigns a value. |
print("dict:", user) | Outputs text to stdout. |
- 1Store and transform collections (filtering, grouping).
- 2Use dicts for fast lookups.
- 1Mutating lists unintentionally.
- 2Using a list where a set/dict would be faster.
- 1Choose the right container: list vs set vs dict.
- 2Keep data transformations clear and readable.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Reverse a String
Learn Reverse a String with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
name = "Mana" | Assigns a value. |
streak = 7 | Assigns a value. |
print(f"{name} has a {streak}-day streak") | Outputs text to stdout. |
print(name.upper()) | Outputs text to stdout. |
print(name[0:2]) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.
Add Two Numbers
Learn Add Two Numbers with a small example you can edit and run.
statement
Edit the Python code below and click Run. The output panel shows stdout and errors.
| Line | Meaning |
|---|---|
a = 7 | Assigns a value. |
b = 3 | Assigns a value. |
print("a+b =", a + b) | Outputs text to stdout. |
print("a//b =", a // b) | Outputs text to stdout. |
print("float('3.14') =", float('3.14')) | Outputs text to stdout. |
- 1Automation scripts, data processing, and backend services.
- 1Indentation errors and missing colons (`:`) in blocks.
- 1Write small functions and test often.
- 1Practice the concept in a tiny script, then reuse it in a real project.
- 2Read error messages carefully—Python is usually very clear.
- 1Change one line and predict the output before running.
- 2Add one more case (edge case) to the example.
- 3Explain the result in 1 sentence.