Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

01 August, 2017

Python


My first steps, or perhaps slithers, have been taken back into coding. Apart from dabbling in a little HTML, I have written no code in years. I saw MIT had a free first year university course in computing and decided to look into it. The language used is Python, and so, I'm starting to learn Python.

One of the interesting things I have found is it only recognises 'True' and 'False' as Boolean values. The capitalisation is most important. This means I can write:

FALSE = True
TRUE = False

The syntax is correct. The static semantics is correct, as it the semantics. The only problem with it is that it's a daft thing for a programmer to do. It's the sort of thing that can land people in programming doo-doo.

I'm also not enamoured by white space being part of the syntax. It whiffs to much of FORTRAN77 which is not a free-format language. However, FORTRAN77 is not case-sensitive, so X is the same variable as x. Must test this out fully in Python!

----

Testing has been completed. X and x are not the same thing. Also, 'True' is not a reserved word. 

    True = False
    variable = True
    print (variable)
    print (True)

This results in:

    False
    False

This is a very strange language, and you really need to keep your eye on it!