Learn EDUBLOCKS with Real Code Examples
Updated Nov 26, 2025
Code Sample Descriptions
1
Hello World in EduBlocks (Python)
print("Hello World")
A simple EduBlocks project that prints 'Hello World'. Blocks generate the Python code below.
3
If-Else Example
x = 10
if x > 5:
print("x is greater than 5")
else:
print("x is 5 or less")
Checks a condition and prints different messages.
4
For Loop Example
for i in range(5):
print(i)
Prints numbers from 0 to 4 using a for loop.
5
While Loop Example
i = 0
while i < 5:
print(i)
i += 1
Prints numbers from 0 to 4 using a while loop.
6
Function Example
def add_numbers(a, b):
print(a + b)
add_numbers(3, 4)
Defines a function that adds two numbers and prints the result.
7
List Example
fruits = ["apple", "banana", "cherry"]
for fruit in fruits:
print(fruit)
Creates a list and prints each element.
8
Dictionary Example
person = {"name": "Alice", "age": 10}
for key in person:
print(key, person[key])
Creates a dictionary and prints keys and values.
9
Input Example
name = input("Enter your name: ")
print("Hello", name)
Takes input from the user and prints it.
10
Random Number Example
import random
num = random.randint(1, 10)
print(num)
Generates a random number between 1 and 10 and prints it.