






"""simple docstring"""




import requests

_snake_case          =   'https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey='

def 			lowerCAmelCase__     (     UpperCamelCase__				):



  '''simple docstring'''
  # fetching a list of articles in json format
  _a  :       Dict             =	requests.get(_NEWS_API + bbc_news_api_key				).json()
  # each article in the list is a dict
  for i, article in enumerate(bbc_news_page["""articles"""]     ,   1				):
    print(F"""{i}.) {article['title']}"""				)


if __name__ == "__main__":
 fetch_bbc_news(bbc_news_api_key='<Your BBC News API key goes here>')









"""simple docstring"""




from __future__ import annotations

def 			lowerCAmelCase__     (     UpperCamelCase__     ,   UpperCamelCase__				):



  '''simple docstring'''
  print(F"""Vertex\tShortest Distance from vertex {src}"""				)
  for i, d in enumerate(UpperCamelCase__				):
    print(F"""{i}\t\t{d}"""				)

def 			lowerCAmelCase__     (     UpperCamelCase__     ,   UpperCamelCase__     ,   UpperCamelCase__				):



  '''simple docstring'''
  for j in range(UpperCamelCase__				):
    _a      ,  _a      ,  _a  :       List[str]             =	(graph[j][k] for k in ["""src""", """dst""", """weight"""])
    if distance[u] != float("""inf"""				) and distance[u] + w < distance[v]:
      return True
  return False

def 			lowerCAmelCase__     (     UpperCamelCase__     ,   UpperCamelCase__     ,   UpperCamelCase__     ,   UpperCamelCase__				):



  '''simple docstring'''
  _a  :       Dict             =	[float("""inf"""				)] * vertex_count
  _a  :       Any             =	0.0

  for _ in range(vertex_count - 1				):
    for j in range(UpperCamelCase__				):
      _a      ,  _a      ,  _a  :       List[Any]             =	(graph[j][k] for k in ["""src""", """dst""", """weight"""])

      if distance[u] != float("""inf"""				) and distance[u] + w < distance[v]:
        _a  :       Any             =	distance[u] + w

  _a  :       Union[str, Any]             =	check_negative_cycle(UpperCamelCase__     ,   UpperCamelCase__     ,   UpperCamelCase__				)
  if negative_cycle_exists:
    raise Exception("""Negative cycle found"""				)

  return distance


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 _snake_case          =   int(input('Enter number of vertices: ').strip())
 _snake_case          =   int(input('Enter number of edges: ').strip())

 _snake_case          =   [{} for _ in range(E)]

 for i in range(E):
  print('Edge ', i + 1)
  _snake_case      , _snake_case      , _snake_case          =   (
      int(x)
      for x in input('Enter source, destination, weight: ').strip().split(' ')
  )
  _snake_case          =   {'src': src, 'dst': dest, 'weight': weight}

 _snake_case          =   int(input('\nEnter shortest path source:').strip())
 _snake_case          =   bellman_ford(graph, V, E, source)
 print_distance(shortest_distance, 0)

