Sleep for milliseconds

Note that there is no standard C API for milliseconds, so (on Unix) you will have to settle for usleep, which accepts microseconds:

Purpose of “%matplotlib inline”

%matplotlib is a magic function in IPython. I’ll quote the relevant documentation here for you to read for convenience: IPython has a set of predefined ‘magic functions’ that you can call with a command line style syntax. There are two kinds of magics, line-oriented and cell-oriented. Line magics are prefixed with the % character and work much like … Read more

How do I check what version of Python is running my script?

This information is available in the sys.version string in the sys module: Human readable: For further processing, use sys.version_info or sys.hexversion: To ensure a script runs with a minimal version requirement of the Python interpreter add this to your code: This compares major and minor version information. Add micro (=0, 1, etc) and even releaselevel … Read more

What is an undefined reference/unresolved external symbol error and how do I fix it?

Compiling a C++ program takes place in several steps, as specified by 2.2 (credits to Keith Thompson for the reference): The precedence among the syntax rules of translation is specified by the following phases [see footnote]. Physical source file characters are mapped, in an implementation-defined manner, to the basic source character set (introducing new-line characters for end-of-line indicators) … Read more

Using global variables in a function

You can use a global variable within other functions by declaring it as global within each function that assigns a value to it: I imagine the reason for it is that, since global variables are so dangerous, Python wants to make sure that you really know that’s what you’re playing with by explicitly requiring the … Read more

What is Turing Complete?

Here’s the briefest explanation: A Turing Complete system means a system in which a program can be written that will find an answer (although with no guarantees regarding runtime or memory). So, if somebody says “my new thing is Turing Complete” that means in principle (although often not in practice) it could be used to … Read more