Created
February 27, 2018 22:37
-
-
Save dilanshah/ae049599e2ca2e0841c59dd2b0d0d631 to your computer and use it in GitHub Desktop.
Given an integer number, write a function that returns true if there are any odd digits in the number; e.g. 2468 -> false, 2478 -> true
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
"Given an integer number, write a function | |
that returns true if there are any odd digits in the | |
number; e.g. 2468 -> false, 2478 -> true" | |
''' | |
class Solution(): | |
def containsOdd(self,n): | |
return any([int(x)%2 for x in list(str(n))]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment