Skip to content

Trinkes/clean-architecture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clean-architecture

Exercise:

With The Clean Architecture in mind, make the following code cleaner:

def find_related_topic(word: str) -> str:
    q = word
    url = 'http://api.duckduckgo.com/?'
    url += urlencode({'q': q, 'format': 'json'})
    response = requests.get(url)
    data = response.json()
    related_topics = data['RelatedTopics']
    if not related_topics:
        raise ValueError('No related topics found')
    for topic in related_topics:
        if topic['Text'] is not None:
            return topic['Text']
    raise ValueError('No related topics found')


print(find_related_topic('java'))

This exercise is based on The Clean Architecture in Python youtube talk.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages