create a binary tree
root = newNode ( 20 ) NEW_LINE root . left = newNode ( 10 ) NEW_LINE root . right = newNode ( 30 ) NEW_LINE root . left . left = newNode ( 5 ) NEW_LINE root . left . right = newNode ( 15 ) NEW_LINE root . left . right . left = newNode ( 12 ) NEW_LINE root . right . left = newNode ( 25 ) NEW_LINE root . right . right = newNode ( 40 ) NEW_LINE print ( " data ▁ at ▁ level ▁ 1 ▁ : ▁ " , end = " " ) NEW_LINE ret = printKDistant ( root , 1 ) NEW_LINE if ( ret == False ) : NEW_LINE INDENT print ( " Number ▁ exceeds ▁ total " , " number ▁ of ▁ levels " ) NEW_LINE DEDENT print ( " data ▁ at ▁ level ▁ 2 ▁ : ▁ " , end = " " ) NEW_LINE ret = printKDistant ( root , 2 ) NEW_LINE if ( ret == False ) : NEW_LINE INDENT print ( " Number ▁ exceeds ▁ total " , " number ▁ of ▁ levels " ) NEW_LINE DEDENT print ( " data ▁ at ▁ level ▁ 3 ▁ : ▁ " , end = " " ) NEW_LINE ret = printKDistant ( root , 3 ) NEW_LINE if ( ret == False ) : NEW_LINE INDENT print ( " Number ▁ exceeds ▁ total " , " number ▁ of ▁ levels " ) NEW_LINE DEDENT print ( " data ▁ at ▁ level ▁ 6 ▁ : ▁ " , end = " " ) NEW_LINE ret = printKDistant ( root , 6 ) NEW_LINE if ( ret == False ) : NEW_LINE INDENT print ( " Number ▁ exceeds ▁ total ▁ number ▁ of ▁ levels " ) NEW_LINE DEDENT