Search Header Logo
Python-Function-Calls-and-Conditionals

Python-Function-Calls-and-Conditionals

Assessment

Presentation

Computers

11th Grade

Practice Problem

Hard

Created by

Almotaz Al Muntaser

Used 1+ times

FREE Resource

10 Slides • 0 Questions

1

media

Python: Function Calls and
Conditionals

we will explore the fundamentals of function calls and
conditionals in Python.

by Al Motaz

LO: Students will be able to demonstrate a clear understanding of Python
function calls, including how to define and invoke functions, pass arguments,
and return values, enabling them to write more organized and modular code.

2

media

LO: Students will be able to demonstrate a clear understanding of Python
function calls, including how to define and invoke functions, pass arguments,
and return values, enabling them to write more organized and modular code.

All Will

Create a basic Python function

: All

students will be able to define a
function called that takes an integer
as an argument.

Use a conditional assignment: All

students will use a conditional
assignment to determine whether
the number is even or odd.

Print the result: All students will print

the result, indicating whether the
number is even or odd.

Most Will
Provide user instructions: Most

students will add user instructions
to input a number and call the
function.

Use descriptive variable names:

Most students will use descriptive
variable names within the function
and clear, user-friendly prompts
for input.

Some Will

Include additional functionality:

Some students may choose to
extend the function to handle
other number properties, such as
checking for prime numbers or
performing arithmetic operations.

3

media

To use a function in Python, we simply write its name followed
by parentheses (print()). We can pass parameters(def ex(x) ) if
the function has arguments(x = ex(5)).

LO: Students will be able to demonstrate a clear understanding of Python
function calls, including how to define and invoke functions, pass arguments,
and return values, enabling them to write more organized and modular code.

In groups of 3:
Create a function called calculate_rectangle_area
This function takes two arguments called length

and width and calculates the area of a rectangle.

Call this function with specific values for length

and width.

Print the result

4

media

Function Basics

In programming, functions are reusable blocks
of code that perform specific tasks. They help
organize code and make it more modular
(smaller - cleaner).

LO: Students will be able to demonstrate a clear understanding of Python
function calls, including how to define and invoke functions, pass arguments, and
return values, enabling them to write more organized and modular code.

print()

this function returns the number
of items in an object. When the
object is a string, the len() function
returns the number of characters
in the string.

Min()

The min() method returns

the minimum element in the
case of integers or floating
type values.

Len()

this function returns the number

of items in an object. When the
object is a string, the len()
function returns the number of
characters in the string.

5

media

Function Definition

To define a function in Python, we use the
def keyword followed by the function name,
parentheses, and a colon. We can also add
parameters inside the parentheses.

LO: Students will be able to demonstrate a clear understanding of Python
function calls, including how to define and invoke functions, pass arguments,
and return values, enabling them to write more organized and modular code.

Parameters or Arguments?

A parameter is the
variable listed
inside the
parentheses in the
function definition.

def num(a):

An argument is the
value that is sent to
the function when
it is called.

x = num(5)

6

media

Return Statement

The return statement is used to specify the value that a function should give back when it is

called. It ends the execution of the function.

LO: Students will be able to demonstrate a clear understanding of Python
function calls, including how to define and invoke functions, pass arguments,
and return values, enabling them to write more organized and modular code.

Print vs. return in Python
Printing and returning are completely
different concepts.

print is a function you call. Calling print will
immediately make your program write out
text for you to see. Use print when you want
to show a value to a human.
Using return changes the flow of the program.
Using print does not.

You can only use return
inside the function body.

Function definitions II

Important details
You can only use return inside a function body.
Note that printing and returning are completely different concepts. If the difference isn't completely clear to you, read this.

Important details
You can only use return inside a function body.
Note that printing and returning are completely different concepts.

7

media

Conditionals

In programming, conditionals help control the flow of
execution based on certain conditions. They allow us to
make decisions within our code.

LO: Students will be able to demonstrate a clear understanding of Python
function calls, including how to define and invoke functions, pass arguments,
and return values, enabling them to write more organized and modular code.

8

media

If Statement

The if statement is a fundamental conditional statement in Python. It executes a block of code

only if a certain condition is met.

LO: Students will be able to demonstrate a clear understanding of Python
function calls, including how to define and invoke functions, pass arguments,
and return values, enabling them to write more organized and modular code.

9

media

Exit Ticket

LO: Students will be able to demonstrate a clear understanding of Python
function calls, including how to define and invoke functions, pass arguments,
and return values, enabling them to write more organized and modular code.

https://quizizz.com/join/gam
e/U2FsdGVkX18T%252FpFYR
crZOe86vl0heWFAwZVszLJ64
m2onTvQj7FqB7IBcifCEAwA?
gameType=solo&page=nps&
page=summary

10

media
pattern-tertiary
media

Python: Function Calls and
Conditionals

we will explore the fundamentals of function calls and
conditionals in Python.

by Al Motaz

LO: Students will be able to demonstrate a clear understanding of Python
function calls, including how to define and invoke functions, pass arguments,
and return values, enabling them to write more organized and modular code.

Show answer

Auto Play

Slide 1 / 10

SLIDE