Introduction to Functions in Python

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/24

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards based on a lecture about functions in Python.

Last updated 3:25 AM on 4/8/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

25 Terms

1
New cards

Function

A reusable block of code that performs a specific task.

2
New cards

Def

The keyword used to define a function in Python.

3
New cards

Call a Function

Using the function's name followed by parentheses () to execute it.

4
New cards

Parameter

A variable inside a function definition.

5
New cards

Argument

The actual value passed into a function.

6
New cards

Difference between Parameter and Argument

Parameter is a placeholder; Argument is the actual value.

7
New cards

Return Statement

Sends a value back and stops the function.

8
New cards

Effect of Return Statement

The function immediately stops executing after the return.

9
New cards

print() vs return

print() displays output; return gives back a value.

10
New cards

Positional Arguments

Arguments passed based on order (must match position).

11
New cards

Missing Required Positional Argument

Python throws an error if a required positional argument is missing.

12
New cards

Default Arguments

Parameters with preset values used if no argument is provided.

13
New cards

Rule for Default Arguments Order

Positional arguments must come before default ones.

14
New cards

Keyword Arguments

Arguments passed using parameter names where order doesn’t matter.

15
New cards

Order of Arguments in Function Call

Positional arguments come first, followed by keyword arguments.

16
New cards

*args

Represents multiple unnamed arguments, stored as a tuple/list.

17
New cards

**kwargs

Represents multiple named arguments, stored as a dictionary.

18
New cards

Scope

The range within which a variable exists and can be used.

19
New cards

Accessing Variables Outside Function

Variables inside a function cannot be accessed outside.

20
New cards

Mutable Data Type

A type that can be changed, such as lists and dictionaries.

21
New cards

Immutable Data Type

A type that cannot be changed, such as integers, strings, and tuples.

22
New cards

Passing Mutable Object into Function

It can be changed permanently.

23
New cards

Passing Immutable Object into Function

Changes do NOT affect the original.

24
New cards

Recursion

A function that calls itself.

25
New cards

Base Case in Recursion

A stopping condition required for recursion to work properly.