🐍 Python Playground

Write, run, and learn Python right here in your browser — no installation needed

Login to Save Progress
Progress 0 / 0 done

Quick Reference

Output
printprint("Hello")
f-stringf"Value: {x}"
Variables
int/float/strx = 10
inputinput("Name: ")
Conditionals
if/elif/elseif x > 0:
Loops
for loopfor i in range(5):
while loopwhile x > 0:
Lists
create/index[1, 2, 3]
methods.append() .sort()
Functions
definedef func(arg):
Math
math moduleimport math
randomrandom.randint()
Strings
methods.upper() .split()
👋 Welcome to Python Playground

Choose an exercise on the left, or write your own code. Click ▶ Run to execute. Your code runs on the Afro-Merica server — same engine as the Python Kids Challenge.

  main.py
Ready
Output
>>> Ready. Press ▶ Run to execute your code.

Ctrl + Enter to run

What You'll Learn

Select an exercise to see learning goals.

Common Errors 🔍

IndentationError
Use 4 spaces inside loops/functions
NameError
Variable not defined yet
TypeError
Wrong type — use int() or str() to convert
SyntaxError
Missing colon : or mismatched brackets
IndexError
List index out of range

💡 Pro Tips

  • Use print() to debug
  • Add # comments to explain
  • Python is case-sensitive: Name ≠ name
  • Indentation = 4 spaces (not tab)
  • Click any snippet in Quick Reference to insert it
Colab

📊 Advanced Python — Google Colab

Full matplotlib, pandas, numpy, scikit-learn — opens in Google Colab

📈
Matplotlib Visualization
Line plots, bar charts, scatter plots, pie charts, subplots
Open in Colab →
📊
Pandas Data Analysis
DataFrames, filtering, groupby, statistics, visualization
Open in Colab →
🔢
NumPy Arrays & Math
Arrays, matrices, linear algebra, statistics, FFT
Open in Colab →
⚛️
Physics Simulations
Projectile motion, escape velocity, pendulum, waves
Open in Colab →
🌍
African Data Analysis
Analyze real data about African countries — population, GDP, life expectancy
Open in Colab →
🤖
Machine Learning Intro
Linear regression, classification, decision trees, scikit-learn
Open in Colab →

ⓘ Requires free Google account · Opens in new tab · All code pre-written and ready to run