




'''simple docstring'''



def 			_UpperCamelCase (_lowerCamelCase							:     int	)->   int:




     '''simple docstring'''





     if number != int(_lowerCamelCase	):
          raise ValueError('''factorial() only accepts integral values'''	)
     if number < 0:
          raise ValueError('''factorial() not defined for negative values'''	)
     __snake_case    					=  1
     for i in range(1   ,	number + 1	):
          value *= i
     return value







def 			_UpperCamelCase (_lowerCamelCase							:     int	)->   int:




     '''simple docstring'''





     if not isinstance(_lowerCamelCase   ,	_lowerCamelCase	):
          raise ValueError('''factorial() only accepts integral values'''	)
     if n < 0:
          raise ValueError('''factorial() not defined for negative values'''	)
     return 1 if n == 0 or n == 1 else n * factorial(n - 1	)


if __name__ == "__main__":
     import doctest

     doctest.testmod()

     UpperCAmelCase_       :  Tuple      =		int(input('''Enter a positive integer: ''').strip() or 0)
     print(F"""factorial{n} is {factorial(n)}""")












'''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() = }""")






