Check if all the digits of the given number are same | Function to check if all the digits in the number N is the same or not ; Find the last digit ; Find the current last digit ; Update the value of N ; If there exists any distinct digit , then return No ; Otherwise , return Yes ; Driver Code
def checkSameDigits ( N ) : NEW_LINE INDENT digit = N % 10 ; NEW_LINE while ( N != 0 ) : NEW_LINE INDENT current_digit = N % 10 ; NEW_LINE N = N // 10 ; NEW_LINE if ( current_digit != digit ) : NEW_LINE INDENT return " No " ; NEW_LINE DEDENT DEDENT return " Yes " ; NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT N = 222 ; NEW_LINE print ( checkSameDigits ( N ) ) ; NEW_LINE DEDENT