Here is a python code block:
import math, random
def greet(name):
print(f"Hello, {name}!")
class Circle:
def __init__(self, r):
self.radius = r
def area(self):
return math.pi * self.radius ** 2
def circumference(self):
return 2 * math.pi * self.radius
if __name__ == "__main__":
greet("Alice")
circle = Circle(5)
print(f"Area: {circle.area():.2f}")
print(f"Circumference: {circle.circumference():.2f}")
squares = [x ** 2 for x in range(1, 11)]
print(f"Squares: {squares}")
person = {"name": "Bob", "age": 35, "city": "New York"}
print(f"Name: {person['name']}")
num = random.randint(1, 10)
print(f"{num} is {'even' if num % 2 == 0 else 'odd'}.")
for i in range(1, 6):
print(f"Iteration {i}")