


'''simple docstring'''


from datetime import date

import requests

lowerCamelCase__     						=  'https://api.carbonintensity.org.uk/intensity'






def 			__lowerCAmelCase			():
		_UpperCAmelCase		:							Optional[int]             =   requests.get(snake_case_ ).json()["data"][0]
		return last_half_hour["intensity"]["actual"]






def 			__lowerCAmelCase			(__lowerCAmelCase   ,			__lowerCAmelCase ):
		return requests.get(F"""{BASE_URL}/{start}/{end}""" ).json()["data"]


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






'''simple docstring'''







from __future__ import annotations

from collections.abc import Generator






def 					_SCREAMING_SNAKE_CASE		(						snake_case_	):
	if not isinstance(snake_case_							,       snake_case_	) or n < 1:
		raise Exception("""Sequence only defined for positive integers"""	)

	yield n
	while n != 1:
		if n % 2 == 0:
			n //= 2
		else:
			_lowercase							=     3 * n + 1
		yield n






def 					_SCREAMING_SNAKE_CASE		(						):
	_lowercase							=     43
	_lowercase							=     tuple(collatz_sequence(snake_case_	)	)
	print(snake_case_	)
	print(F"""Collatz sequence from {n} took {len(snake_case_	)} steps."""	)


if __name__ == "__main__":
							main()




