Friday, October 3, 2025
HomeLanguagesPython | sympy.is_even() method

Python | sympy.is_even() method

In the sympy 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: 

Python3




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


Output: 

True
False

Code #2: 

Python3




# Python program to check even number
# using sympy.is_even() method
 
# importing sympy module
from sympy import *
 
# calling is_even function on different numbers
geek1 = simplify(2).is_even
geek2 = simplify(-45).is_even
geek3 = simplify(-40).is_even
 
print(geek1)
print(geek2)
print(geek3)


Output: 

True
False
True
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32331 POSTS0 COMMENTS
Milvus
85 POSTS0 COMMENTS
Nango Kala
6703 POSTS0 COMMENTS
Nicole Veronica
11867 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11929 POSTS0 COMMENTS
Shaida Kate Naidoo
6818 POSTS0 COMMENTS
Ted Musemwa
7080 POSTS0 COMMENTS
Thapelo Manthata
6775 POSTS0 COMMENTS
Umr Jansen
6776 POSTS0 COMMENTS