Whitespace and Formatting

White Space

White space is used to identify blocks of code. Python enforces this and will raise errors when this is not included and fail to run s expected.

Key words that should be followed by an indented block are def, class, if, while, for, elif, else, try, with, except and finally.

 
It is recommended that each block should be indented with 4 spaces. Though you can use tabs. The key point here is to be consistent, there is nothing worse than maintaining code that has been inconstant.

Case Sensitivity

Python is case sensitive so care and consistency is required when naming objects.




Related Sections

Python - Learn the python from the basics up. This fast track example code course will get you creating powerful python programs in no time.
Tkinter - Learn the key features of the tkinter to allow you to create user interfaces for your python programs.


Related Pages

Pickle - The pickle library allows a program to save data in a binary file.
Python - List Comprehension - Create powerful list comprehension expressions.
Python - Generators - Learn about generator statements.
Python - Data types - The learn about the key datatypes in the python language.
Tkinter - Combo Box - This is a short example showing how to use combo boxes in a GUI.
Tkinter - Radio Buttons - A short example of how to create a GUI with radio buttons.
Tkinter - Canvas - Canvas allows for a range of shapes to be plotted, such as circles, squares, lines