...

/

Exercise 3: Even or Odd?

Exercise 3: Even or Odd?

Check whether a number is even or odd.

We'll cover the following...

Problem statement

Given an integer, determine if that number is even or not. If the number is even, return 0. Otherwise, return 1.

Example

num = 5
result = 1

num = 2
result = 0

Try it yourself

Press + to interact
def even_or_odd(num)
result = -99
# Start your code here
return result
end
Loginto save progress

Exercise 2: Finding Modulo

Working with Strings

Loginto save progress