




'''simple docstring'''



def 			_UpperCamelCase (_lowerCamelCase							:     list[int]	)->   int:




     '''simple docstring'''





     __snake_case    					=  len(_lowerCamelCase	)
     if n in (0, 1):
          return 0
     return sum(query * (n - i - 1) for i, query in enumerate(sorted(_lowerCamelCase	)	)	)


if __name__ == "__main__":
     import doctest

     doctest.testmod()





'''simple docstring'''



from datetime import date

import requests

UpperCAmelCase_       :  str      =		'''https://api.carbonintensity.org.uk/intensity'''







def 			_UpperCamelCase ()->   str:




     '''simple docstring'''





     __snake_case    					=  requests.get(_lowerCamelCase	).json()['''data'''][0]
     return last_half_hour["intensity"]["actual"]







def 			_UpperCamelCase (_lowerCamelCase							:     Dict   ,	_lowerCamelCase							:     List[Any]	)->   list:




     '''simple docstring'''





     return requests.get(f'''{BASE_URL}/{start}/{end}'''	).json()["data"]


if __name__ == "__main__":
     for entry in fetch_from_to(start=date(2_0_2_0, 1_0, 1), end=date(2_0_2_0, 1_0, 3)):
          print('''from {from} to {to}: {intensity[actual]}'''.format(**entry))
     print(F"""{fetch_last_half_hour() = }""")






