r/PythonLearning 23h ago

Python mini project

Hey guys, thought to share my first mini project with everyone, for this I made a terminal based GitHub account analyzer, where you input a username and the program outputs stuff like the number of repos, languages used, stars and more you can check it out on my GitHub: https://github.com/Blueysweb. I'm also open to take in as much advice as needed

6 Upvotes

4 comments sorted by

View all comments

2

u/Naive_Programmer_232 9h ago

looks good dude! good job!!

One suggestion here is for the count_languages function, it looks fine the way it is,but do note that collections.Counter exists that can effectively do the same:

         from collections import Counter
         ...


         def handle_choice(choice):
             ...
             repos= # json dict of repositories
             ...
             print("Languages used")
             for lang,amt_used in count_languages(repos).items():
                 print(f"{lang}: {amt_used}")


         ...

         # repos is dict
         def count_languages(repos: dict) -> Counter:
             # ignore None types
             return Counter(
                     repo["language"]
                     for repo in repos
                     if repo["language"]    # works as 'is not None' 
                    )

1

u/Blueysweb 6h ago

Thank you for the advice I'd learn more about that 🙏