Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Odd and Even | Conditional Statements
Introduction to Python
course content

Course Content

Introduction to Python

Introduction to Python

1. First Acquaintance
2. Variables and Types
3. Conditional Statements
4. Other Data Types
5. Loops
6. Functions

Challenge: Odd and Even

Let's tackle another practice task!

Task

You're provided with a number labeled num. Using if/else, display the message:

  • "The number num is odd" if num is odd.
  • "The number num is even" if num is even.

In the print() functions, fill in the ___ with the appropriate descriptor ('odd' or 'even'). Tip: A number is considered even if, when divided by 2, the remainder (using the % operator) is 0.

Note

In Python, the % operator is used as the modulo operator, which returns the remainder after dividing one number by another. For example, 5 % 2 would return 1, since 2 goes into 5 twice with a remainder of 1.

Odd and Even

Task

You're provided with a number labeled num. Using if/else, display the message:

  • "The number num is odd" if num is odd.
  • "The number num is even" if num is even.

In the print() functions, fill in the ___ with the appropriate descriptor ('odd' or 'even'). Tip: A number is considered even if, when divided by 2, the remainder (using the % operator) is 0.

Note

In Python, the % operator is used as the modulo operator, which returns the remainder after dividing one number by another. For example, 5 % 2 would return 1, since 2 goes into 5 twice with a remainder of 1.

Odd and Even

Everything was clear?

Section 3. Chapter 8
toggle bottom row

Challenge: Odd and Even

Let's tackle another practice task!

Task

You're provided with a number labeled num. Using if/else, display the message:

  • "The number num is odd" if num is odd.
  • "The number num is even" if num is even.

In the print() functions, fill in the ___ with the appropriate descriptor ('odd' or 'even'). Tip: A number is considered even if, when divided by 2, the remainder (using the % operator) is 0.

Note

In Python, the % operator is used as the modulo operator, which returns the remainder after dividing one number by another. For example, 5 % 2 would return 1, since 2 goes into 5 twice with a remainder of 1.

Odd and Even

Task

You're provided with a number labeled num. Using if/else, display the message:

  • "The number num is odd" if num is odd.
  • "The number num is even" if num is even.

In the print() functions, fill in the ___ with the appropriate descriptor ('odd' or 'even'). Tip: A number is considered even if, when divided by 2, the remainder (using the % operator) is 0.

Note

In Python, the % operator is used as the modulo operator, which returns the remainder after dividing one number by another. For example, 5 % 2 would return 1, since 2 goes into 5 twice with a remainder of 1.

Odd and Even

Everything was clear?

Section 3. Chapter 8
toggle bottom row

Challenge: Odd and Even

Let's tackle another practice task!

Task

You're provided with a number labeled num. Using if/else, display the message:

  • "The number num is odd" if num is odd.
  • "The number num is even" if num is even.

In the print() functions, fill in the ___ with the appropriate descriptor ('odd' or 'even'). Tip: A number is considered even if, when divided by 2, the remainder (using the % operator) is 0.

Note

In Python, the % operator is used as the modulo operator, which returns the remainder after dividing one number by another. For example, 5 % 2 would return 1, since 2 goes into 5 twice with a remainder of 1.

Odd and Even

Task

You're provided with a number labeled num. Using if/else, display the message:

  • "The number num is odd" if num is odd.
  • "The number num is even" if num is even.

In the print() functions, fill in the ___ with the appropriate descriptor ('odd' or 'even'). Tip: A number is considered even if, when divided by 2, the remainder (using the % operator) is 0.

Note

In Python, the % operator is used as the modulo operator, which returns the remainder after dividing one number by another. For example, 5 % 2 would return 1, since 2 goes into 5 twice with a remainder of 1.

Odd and Even

Everything was clear?

Let's tackle another practice task!

Task

You're provided with a number labeled num. Using if/else, display the message:

  • "The number num is odd" if num is odd.
  • "The number num is even" if num is even.

In the print() functions, fill in the ___ with the appropriate descriptor ('odd' or 'even'). Tip: A number is considered even if, when divided by 2, the remainder (using the % operator) is 0.

Note

In Python, the % operator is used as the modulo operator, which returns the remainder after dividing one number by another. For example, 5 % 2 would return 1, since 2 goes into 5 twice with a remainder of 1.

Odd and Even

Section 3. Chapter 8
Switch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt