input: Write a function to read the contents from a given URL. If the request is successful, return the content of the URL, otherwise return None.
  def read_url(url):
    r = requests.get(url)
    if r.status_code == 200:
      return r.text
    else:
      return None
  
  assert read_url("https://jsonplaceholder.typicode.com/posts/1") == """{
    "userId": 1,
    "id": 1,
    "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
    "body": "quia et suscipit\\nsuscipit recusandae consequuntur expedita et cum\\nreprehenderit molestiae ut ut quas totam\\nnostrum rerum est autem sunt rem eveniet architecto"
  }"""
  assert read_url("https://jsonplaceholder.typicode.com/nonexistent") == None
  assert read_url("") == None
output: def read_url(url):
    try:
      r = requests.get(url)
      if r.status_code == 200:
        return r.text
      else:
        return None
    except:
      return None