Mathedu Courses logo

Mathedu Courses

If you see this, something is wrong

Table of contents

First published on Monday, Feb 23, 2026 and last modified on Tuesday, Feb 24, 2026

Lecture 5 - Conditionals if elif else

Fabienne Chaplais Email

1 Lecture 5

2%2
3%2
101%2
10%2
(-4)%2
(-5)%2
0%2
2.5%2
def parity(n):
    if n%2 == 0:
        return 'even'
    elif n%2 == 1:
        return 'odd'
    else:
        return 'non integer'
Parity(2)
Parity(-4)
Parity(3)
Parity(-5)
Parity(5.1)

Discussion: login to participate.