Python | sympy.is_even() method

In simpy module, we can test whether a given number n is even or not using sympy.is_even() function.

Syntax:  sympy.is_even(n)
Parameter:  n; number to be tested
Return:  bool value result 
Code #1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Python program to check even number
# using sympy.is_even() method
  
# importing sympy module
from sympy import *
  
# calling is_evenfunction on differnet numbers
geek1 = simplify(30).is_even
geek2 = simplify(13).is_even
  
print(geek1)
print(geek2)

chevron_right


Output:



True
False

Code #2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Python program to check even number
# using sympy.is_even() method
  
# importing sympy module
from sympy import *
  
# calling is_even function on differnet numbers
geek = simplify(2).is_even
  
print(geek)

chevron_right


Output:

True


My Personal Notes arrow_drop_up

Recommended Posts:



    Article Tags :

    Be the First to upvote.


    Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.