2-min Computer Science Concepts

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 …

Python Comments — 2-Minute Guide with Exercise Read More »

Python raw_input() vs input()

Summary: The key differences between raw_input() and input() functions are the following: raw_input() can be used only in Python 2.x and is obsolete in Python 3.x and above and has been renamed input() In Python 2.x, raw_input() returns a string whereas input() returns result of an evaluation. While in Python 3.x input() returns a string …

Python raw_input() vs input() 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 …

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

[2-min CS Concepts] A Rapid Introduction to the PubSub Communication Pattern

Did you check the news today? Or receive an email newsletter from a company? This type of communication is one way. Information flows from a publisher to the subscribers. The publisher creates information, the subscriber consumes information. Thus, computer scientists call this communication pattern publish and subscribe paradigm – pubsub. When consuming news, you seek …

[2-min CS Concepts] A Rapid Introduction to the PubSub Communication Pattern Read More »

[2-min CS Concepts] A Rapid Introduction to Decision Trees for Machine Learning

Deep learning has become the megatrend within artificial intelligence and machine learning. Yet, training large neural networks is not always the best choice. It’s the bazooka in machine learning, effective but not efficient. A human will not understand in practice why the neural network classifies one way or the other. It is just a black …

[2-min CS Concepts] A Rapid Introduction to Decision Trees for Machine Learning Read More »

[2-min CS Concepts] What is a Hypergraph?

You most likely know graphs. The web graph consists of websites connected via hyperlinks. The websites are graph vertices and the hyperlinks are graph edges. Each graph edge connects exactly two vertices. What happens if you drop this limitation and allow each edge to connect an arbitrary number of vertices? Simple: you get a hypergraph. …

[2-min CS Concepts] What is a Hypergraph? Read More »