Python | sympy.is_odd() method

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

Syntax:  sympy.is_odd(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 odd number
# using sympy.is_odd() method
  
# importing sympy module
from sympy import *
  
# calling is_odd function on differnet numbers
geek1 = simplify(30).is_odd
geek2 = simplify(13).is_odd
  
print(geek1)
print(geek2)

chevron_right


Output:



False
True

Code #2:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

False


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


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