Python Comments — 2-Minute Guide with Exercise

Wouldn’t reading code be much easier if the author constantly shared their thoughts with you? Commenting is good practice in Python because it helps others (and your future self) understanding your code much better. Writing commented code makes you more productive in the long term! There are two types of comments: one-line comments and multi-line … Read more

How To Resolve UnboundLocalError On Local Variable When Reassigned After The First Use?

Summary: To resolve an UnboundLocalError when the local variable is reassigned after the first use, you can either use the global keyword or the nonlocal keyword. The global keyword allows you to modify the values of a global variable from within a function’s local scope while the nonlocal keyword provides similar functionality in case of … Read more