Even Odd Program in Python using Function
Even Numbers : Those numbers which are completely divisible by 2 are called even numbers. for example : 2, 4, 6, 8 are even numbers. When we divide 242 by 2, it returns remainder ZERO which shows that 242 is an even number.
Odd Numbers : Those numbers which are not completely divisible by 2 are called odd numbers. for example when we divide 31 by 2, it returns remainder ONE, which shows that it is an odd number.
In Python Modulus Operator(%) is used to find the remainder. for example
print(75 % 2) will print 1 # Since remainder is 1 so 75 is an odd number print(44 % 2) will print 0 # Since remainder is 0 so 44 is an even number
Write a program in python to find whether a number is even or odd using function.
Write a function evenodd() which takes a number as an argument and check whether a number is even or odd.
In the above code we are passing a static number ie 10 as an argument to the function. The above program will always return the same output shown below :
OUTPUT of above code is :
10, is an even number
In the above code, we are taking number as an input from the user and passing that number as an argument to the function.
OUTPUT – 1
OUTPUT – 2
MCQ of Computer Science Chapter Wise
2. Flow of Control (Loop and Conditional statement)
3. 140+ MCQ on Introduction to Python
4. 120 MCQ on String in Python
7. 100+ MCQ on Flow of Control in Python
8. 60+ MCQ on Dictionary in Python
100 Practice Questions on Python Fundamentals
120+ MySQL Practice Questions
90+ Practice Questions on List
50+ Output based Practice Questions
100 Practice Questions on String
70 Practice Questions on Loops
70 Practice Questions on if-else
Disclaimer : I tried to give you the correct coding of ” Even Odd Program in Python using Function” , but if you feel that there is/are mistakes in the code or explanation of “ Even Odd Program in Python using Function “ given above, you can directly contact me at email@example.com.