import requests
import re

def findAllLanguages():
    "Find a list of Crowdin language codes to which KA is translated to"
    response = requests.get("https://crowdin.com/project/khanacademy")
    txt = response.text
    for match in re.findall(r"https?://[a-z0-9]*\.cloudfront\.net/images/flags/([^\.]+)\.png", txt):
        yield match

if __name__ == "__main__":
    print(list(findAllLanguages()))
import requests
import re

def findAllLanguages():
    "Find a list of Crowdin language codes to which KA is translated to"
    response = requests.get("https://crowdin.com/project/khanacademy")
    txt = response.text
    langs = set()
    for match in re.findall(r"https?://[a-z0-9]*\.cloudfront\.net/images/flags/([^\.]+)\.png", txt):
        langs.add(match)
    return langs

if __name__ == "__main__":
    print(findAllLanguages())
Return language set instead of language generator
Return language set instead of language generator

  import requests
  import re
  
  def findAllLanguages():
      "Find a list of Crowdin language codes to which KA is translated to"
      response = requests.get("https://crowdin.com/project/khanacademy")
      txt = response.text
+     langs = set()
      for match in re.findall(r"https?://[a-z0-9]*\.cloudfront\.net/images/flags/([^\.]+)\.png", txt):
-         yield match
+         langs.add(match)
+     return langs
  
  if __name__ == "__main__":
-     print(list(findAllLanguages()))
+     print(findAllLanguages())
Return language set instead of language generator
## Code Before:
import requests
import re

def findAllLanguages():
    "Find a list of Crowdin language codes to which KA is translated to"
    response = requests.get("https://crowdin.com/project/khanacademy")
    txt = response.text
    for match in re.findall(r"https?://[a-z0-9]*\.cloudfront\.net/images/flags/([^\.]+)\.png", txt):
        yield match

if __name__ == "__main__":
    print(list(findAllLanguages()))
## Instruction:
Return language set instead of language generator
## Code After:
import requests
import re

def findAllLanguages():
    "Find a list of Crowdin language codes to which KA is translated to"
    response = requests.get("https://crowdin.com/project/khanacademy")
    txt = response.text
    langs = set()
    for match in re.findall(r"https?://[a-z0-9]*\.cloudfront\.net/images/flags/([^\.]+)\.png", txt):
        langs.add(match)
    return langs

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