Monday, June 2, 2014

Odd and Even Number Checker in Python


Learning is a continues process this is true specially we are working in the field of Information Technology. A field that everyday is changing in terms of new development in technology we must able to adapt new methods how to manage information to be beneficial not only to us but also to other people.

In this article I will continue my study and sharing my sample program using Python as my programming language by this time I called this program Odd and Even Number Checker in Python. Writing programs in Python makes me realize that this programming language is easy and simple to use anyone who reads my article I encourage each of you to give Python a try in your programming projects on hand it will make your life much easier and enjoyable way to write code.

What the program will do is to ask the use to enter a number and then our program will determine whether the number that is being given by the user is odd or even number. I write a simple function in python to determine if the number is an odd or even number. Below is the function that I wrote I name it check_value with a parameter that I named number.

def check_value(number):
 if  (number%2 == 0):
    print("The number" ,number,"is an Even Number.")
 else:
   print("The number" ,number, "is an Odd Number.")
   return

I hope you will find my work useful and beneficial in your learning how to program in Python programming language.

Thank you very much.

Sample Output Of our Program


Python Integrated Programming Environment

Program Listing

# Odd and Even Number Checker
# Written By: Mr. Jake R. Pomperada, MAED-IT
# Tools : Python
# Date  : June 2, 2014 Monday

def check_value(number):
 if  (number%2 == 0):
    print("The number" ,number,"is an Even Number.")
 else:
   print("The number" ,number, "is an Odd Number.")
   return

print("\n")
print("@==================================@")
print("    ODD AND EVEN NUMBER CHECKER     ")
print("@==================================@")

complete = False
while complete == False:
 print("");
 value = int(input("Kindly Enter A Number :=> "))
 print("");
 check_value(value);
 print("")

 choice = input("Are You Finish?  Y/N: ").lower().strip()

 if choice == "y":
      complete = True
 else:
      print("")

print("\n")
print("Thank You For Using This Program.")
print("\n")       






No comments:

Post a Comment