How do I programmatically find the core version?
I found this example in MetatagNodeTranslationTest.

To find the drupal version in your code, 

\Drupal::VERSION


will return it.

If you need to compare

if (floatval(\Drupal::VERSION) &lt;= 8.3) {
  // do some stuff.
}