input: Write a python function to get the titles of the top 20 posts from a given subreddit using the Reddit API.
  assert get_top_20_posts("dataisbeautiful") == ["Title1", "Title2", "Title3", ..., "Title20"]
  assert get_top_20_posts("python") == ["TitleA", "TitleB", "TitleC", ..., "TitleT"]
  assert get_top_20_posts("learnprogramming") == ["TitleX", "TitleY", "TitleZ", ..., "TitleW"]
output: import requests
  
  def get_top_20_posts(subreddit):
      url = f"https://www.reddit.com/r/{subreddit}/top.json?limit=20"
      headers = {'User-agent': 'Mozilla/5.0'}
      response = requests.get(url, headers=headers)
      if response.status_code == 200:
          data = response.json()
          titles = [post['data']['title'] for post in data['data']['children']]
          return titles
      else:
          return []