Logo

Python: Constants

Some data never change - for example, mathematical constants. Take π as an example. It is always 3.14 and cannot change. Python uses constants to refer to this kind of data:

PI = 3.14
print(PI)  # => 3.14

A constant is created in the same way as a variable. The only difference is that constants are usually named with capital letters have and _ as a separator between words. A constant, like a variable, can be used in any expression.

Instructions

Create a constant DRAGONS_BORN_COUNT and write the number 3 in it, which is the number of dragons born to Daenerys.

If you've reached a deadlock it's time to ask your question in the «Discussions». How ask a question correctly:

  • Be sure to attach the test output, without it it's almost impossible to figure out what went wrong, even if you show your code. It's complicated for developers to execute code in their heads, but having a mistake before their eyes most probably will be helpful.
Found a bug? Have something to add? Pull requests are welcome!