TalentJR

Lesson 13

Creating Functions

Organize code using functions

1What is a Function?✨

A reusable block of code that does one job.

2Simple Function🎯

💻 code
def greet():
    print("Hello!")
💻 code
greet()  # Call the function

3Functions with Parameters💡

💻 code
def greet(name):
    print(f"Hello, {name}!")
💻 code
greet("Alice")

4Functions with Return🚀

💻 code
def add(a, b):
    return a + b
💻 code
result = add(5, 3)  # result = 8

5Multiple Parameters🔍

💻 code
def calculate_total(price, tax_rate):
    tax = price * tax_rate
    return price + tax
💻 code
total = calculate_total(100, 0.08)  # 108

6Real Examples⭐

💻 code
def check_grade(score):
    if score >= 90:
        return "A"
    elif score >= 80:
        return "B"
    else:
        return "C"
💻 code
grade = check_grade(95)  # "A"
💻 code
def area_of_circle(radius):
    return 3.14 * radius * radius

🎯 Practice Challenges

Master Creating Functions by completing all 3 difficulty levels

🟢 EASY

Creating Functions - Easy Challenge

Start with the basics. Perfect for beginners!

🟡 MEDIUM

Creating Functions - Medium Challenge

Get more challenging. Build your confidence!

🔴 HARD

Creating Functions - Hard Challenge

Master this concept. Prove your skills!

🏆 Study a lesson for 2+ minutes to earn +10 TalentJR Points a day. Badges, certificates & prizes →

Ready to Master Creating Functions? 🚀

Complete the challenges, take the quiz and keep your learning streak going!