Count of binary strings of given length consisting of at least one 1 | Function to return the count of Strings ; Calculate pow ( 2 , n ) ; Return pow ( 2 , n ) - 1 ; Driver Code
def count_Strings ( n ) : NEW_LINE INDENT x = 1 ; NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT x = ( 1 << x ) ; NEW_LINE DEDENT return x - 1 ; NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = 3 ; NEW_LINE print ( count_Strings ( n ) ) ; NEW_LINE DEDENT