Functions in Python

Python for Data Science 123 views Nov 14, 2025 1 min read

Defining a Function

def greet():
    print("Hello!")

Function with Parameters

def add(a, b):
    return a + b

Default Arguments

def area(radius, pi=3.14):
    return pi * radius * radius

Keyword Arguments

print(area(pi=3.1416, radius=5))

Importance in Data Science

Functions help modularize tasks like:

  • Data cleaning
  • Feature engineering
  • Model evaluation
Some advanced sections are available for Registered Members
Share this Post
🚀 Want to Test Your Knowledge?

Take quizzes related to this topic and see where you stand!

Start Quiz Now
Back to Tutorials