def _print_example(code):
    print(code)


def ex1():
    code = '''# Example 1: Hello World

print("Hello World")
'''
    _print_example(code)


def ex2():
    code = '''# Example 2: Text to Speech

import pyttsx3

engine = pyttsx3.init()
engine.setProperty('rate', 170)
engine.setProperty('volume', 0.9)

voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)

text = input("Enter the text: ")

engine.say(text)
engine.runAndWait()
'''
    _print_example(code)


def ex3():
    code = '''# Example 3: Sum of numbers

a = int(input("Enter a number: "))
b = int(input("Enter another number: "))

print("Sum:", a + b)
'''
    _print_example(code)


def ex4():
    code = '''# Example 4: Simple if condition

n = int(input("Enter a number: "))

if n % 2 == 0:
    print("Even")
else:
    print("Odd")
'''
    _print_example(code)


def ex5():
    code = '''# Example 5: For loop

for i in range(1, 6):
    print(i)
'''
    _print_example(code)


# You can continue same pattern

def ex6():
    code = '''# Example 6: While loop

i = 1
while i <= 5:
    print(i)
    i += 1
'''
    _print_example(code)


def ex7():
    code = '''# Example 7: List operations

nums = [1, 2, 3, 4]
nums.append(5)

print(nums)
'''
    _print_example(code)


def ex8():
    code = '''# Example 8: Function definition

def greet(name):
    return f"Hello {name}"

print(greet("Vikram"))
'''
    _print_example(code)


def ex9():
    code = '''# Example 9: File handling

with open("demo.txt", "w") as f:
    f.write("Hello File")
'''
    _print_example(code)


def ex10():
    code = '''# Example 10: Exception handling

try:
    x = int(input("Enter a number: "))
    print(10 / x)
except ZeroDivisionError:
    print("Cannot divide by zero")
'''
    _print_example(code)
