Saturday, 20 June 2020

Check Is Odd and am at 61 percent completion.. congratulations



again amazing

tap tap tap
on my back
good job

wow
i am so old
my first entry was back 13 years ago
http://lifenstudy.blogspot.com/2007/07/my-life-now.html

Quote"
this is my first entry and first attempt to write a blog.


hope i learn through writing and inspire others
as others had inspire me. good luck to me.

keep smiling and keeping working hard.

hope one day i earn peace before i die and go to jannatul firdaus. amin.

will write again later.
bye
end Quote"


"""
@CLEVER PROGRAMMER

Write a function is_odd that takes 
in a number and returns True if it is odd,
otherwise false.

HINT:
Question: What does it mean for a number 
to be divisible by another number?

Answer: number % another_number == 0 
# Gives you true

Ex: 12 % 3 == 0  --> True  
--> This means 12 is divisble by 3.

BONUS CHALLENGE:
Write the function solution in 1 line 
of code without using if statements.
"""

# Make sure to un-comment the function line below when you are done.
# Remember to name your function is_odd
# WRITE YOUR CODE HERE...

def is_odd(number):
    if number % 2 == 1:
       return True
    else:
        return False

# DO NOT remove lines below here,
# this is designed to test your code.

def test_is_odd():
  assert is_odd(2) == False
  assert is_odd(3) == True
  assert is_odd(8) == False
  assert is_odd(100) == False
  assert is_odd(101) == True
  print("YOUR CODE IS CORRECT!")
  
# test your code by un-commenting the line(s) below
test_is_odd()

No comments: