

_UpperCamelCase     =    (1, 153, 370, 371, 1634, 2467_8051, 115_1322_1901_8763_9925_6509_5597_9739_7152_2401)
_UpperCamelCase     =    (-153, -1, 0, 1.2, 200, '''A''', [], {}, None)
def 		UpperCamelCase_(    snake_case__:						int     ) ->				bool:
 if not isinstance(snake_case__						,					snake_case__     ) or n < 1:
  return False

 # Initialization of sum and number of digits.
 UpperCAmelCase__           =       0
 UpperCAmelCase__           =       0
 UpperCAmelCase__           =       n
 # Calculation of digits of the number
 while temp > 0:
  number_of_digits += 1
  temp //= 10
 # Dividing number into separate digits and find Armstrong number
 UpperCAmelCase__           =       n
 while temp > 0:
  UpperCAmelCase__           =       temp % 10
  total += rem**number_of_digits
  temp //= 10
 return n == total
def 		UpperCamelCase_(    snake_case__:						int     ) ->				bool:
 if not isinstance(snake_case__						,					snake_case__     ) or n < 1:
  return False

 # Init a "histogram" of the digits
 UpperCAmelCase__           =       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
 UpperCAmelCase__           =       0
 UpperCAmelCase__           =       0
 UpperCAmelCase__           =       n
 while temp > 0:
  UpperCAmelCase__       ,					UpperCAmelCase__           =       divmod(snake_case__						,					10     )
  digit_histogram[rem] += 1
  digit_total += 1

 for cnt, i in zip(snake_case__						,					range(len(snake_case__     )     )     ):
  total += cnt * i**digit_total

 return n == total
def 		UpperCamelCase_(    snake_case__:						int     ) ->				bool:
 if not isinstance(snake_case__						,					snake_case__     ) or n < 1:
  return False
 UpperCAmelCase__           =       len(str(snake_case__     )     )  # the power that all digits will be raised to
 # check if sum of each digit multiplied expo times is equal to number
 return n == sum(int(snake_case__     ) ** expo for i in str(snake_case__     )     )
def 		UpperCamelCase_(    ) ->				int:
 UpperCAmelCase__           =       int(input('Enter an integer to see if it is an Armstrong number: '     ).strip()     )
 print(f"{num} is {'' if armstrong_number(snake_case__     ) else 'not '}an Armstrong number."     )
 print(f"{num} is {'' if narcissistic_number(snake_case__     ) else 'not '}an Armstrong number."     )
 print(f"{num} is {'' if pluperfect_number(snake_case__     ) else 'not '}an Armstrong number."     )


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 main()






from __future__ import annotations



class 					lowercase		:



 '''simple docstring'''


 def __init__(self , __a				)				->      None:






  """simple docstring"""





  UpperCAmelCase__           =       vertices
  UpperCAmelCase__           =       [[0] * vertices for _ in range(__a				)]




 def 						UpperCamelCase__							(self , __a				)				->      None:






  """simple docstring"""





  print('Vertex \t Distance from Source'				)
  for vertex in range(self.vertices				):
   print(__a , '\t\t' , distances_from_source[vertex]				)




 def 						UpperCamelCase__							(self , __a , __a				)				->      int:






  """simple docstring"""





  UpperCAmelCase__           =       1E7
  UpperCAmelCase__           =       0

  # Search not nearest vertex not in the shortest path tree
  for vertex in range(self.vertices				):
   if distances_from_source[vertex] < minimum and visited[vertex] is False:
    UpperCAmelCase__           =       distances_from_source[vertex]
    UpperCAmelCase__           =       vertex
  return min_index




 def 						UpperCamelCase__							(self , __a				)				->      None:






  """simple docstring"""





  UpperCAmelCase__           =       [int(1E7				)] * self.vertices  # distances from the source
  UpperCAmelCase__           =       0
  UpperCAmelCase__           =       [False] * self.vertices

  for _ in range(self.vertices				):
   UpperCAmelCase__           =       self.minimum_distance(__a , __a				)
   UpperCAmelCase__           =       True

   # Update dist value of the adjacent vertices
   # of the picked vertex only if the current
   # distance is greater than new distance and
   # the vertex in not in the shortest path tree
   for v in range(self.vertices				):
    if (
        self.graph[u][v] > 0
        and visited[v] is False
        and distances[v] > distances[u] + self.graph[u][v]
    ):
     UpperCAmelCase__           =       distances[u] + self.graph[u][v]

  self.print_solution(__a				)


if __name__ == "__main__":
 _UpperCamelCase     =    Graph(9)
 _UpperCamelCase     =    [
     [0, 4, 0, 0, 0, 0, 0, 8, 0],
     [4, 0, 8, 0, 0, 0, 0, 11, 0],
     [0, 8, 0, 7, 0, 4, 0, 0, 2],
     [0, 0, 7, 0, 9, 14, 0, 0, 0],
     [0, 0, 0, 9, 0, 10, 0, 0, 0],
     [0, 0, 4, 14, 10, 0, 2, 0, 0],
     [0, 0, 0, 0, 0, 2, 0, 1, 6],
     [8, 11, 0, 0, 0, 0, 1, 0, 7],
     [0, 0, 2, 0, 0, 0, 6, 7, 0],
 ]
 graph.dijkstra(0)



