



'''simple docstring'''





from __future__ import annotations

import requests
def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase      ) ->    Dict:



    """simple docstring"""





    lowerCAmelCase__			:  Any											= f"""https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty"""
    return requests.get(__lowerCAmelCase      ).json()
def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase = 10      ) ->    List[str]:



    """simple docstring"""





    lowerCAmelCase__			:  Dict											= """https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"""
    lowerCAmelCase__			:  Union[str, Any]											= requests.get(__lowerCAmelCase      ).json()[:max_stories]
    return [get_hackernews_story(__lowerCAmelCase      ) for story_id in story_ids]
def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase = 10      ) ->    Any:



    """simple docstring"""





    lowerCAmelCase__			:  Dict											= hackernews_top_stories(__lowerCAmelCase      )
    return "\n".join("""* [{title}]({url})""".format(**__lowerCAmelCase      ) for story in stories      )


if __name__ == "__main__":
 print(hackernews_top_stories_as_markdown())







'''simple docstring'''





from PIL import Image
def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase      ):



    """simple docstring"""





    lowerCAmelCase__				,       lowerCAmelCase__			:  Dict											= image.size
    lowerCAmelCase__			:  int											= 0
    lowerCAmelCase__			:  int											= image.load()
    for i in range(UpperCamelCase      ):
        for j in range(UpperCamelCase      ):
            lowerCAmelCase__			:  int											= pixels[j, i]
            mean += pixel
    mean //= width * height

    for j in range(UpperCamelCase      ):
        for i in range(UpperCamelCase      ):
            lowerCAmelCase__			:  Dict											= 255 if pixels[i, j] > mean else 0
    return image


if __name__ == "__main__":
 _lowerCAmelCase										=     mean_threshold(Image.open('''path_to_image''').convert('''L'''))
 image.save('''output_image_path''')


