Python is an open source, high-level programming language developed by Guido Van Rossum in the late 1980s and presently administered by Pythin Software Foundation. It came from the ABC language that he helped create early on in his career. Python is a powerful language that you can use to create games, write GUIs and develop web applications. It is a high level language. Reading and writing codes in python is much like reading and writing regular English statements. Python is an interpreted language which means that every time a program is run, its interpreter runs through the code and translates it into machine-readable byte code. Python is an object oriented language that allows users to manage and control data structures or objects to create and run programs.
Python is dynamically-typed and garbage-collected. It supports multiple programming paradigms, including structured, procedural, object-oriented and functional programming. Python programs use clear, simple, and concise instructions that are easy to read even by those who have no substantial programming background. Programs written in python are therefore easier to maintain, debug or enhance. Codes used in python are considerably shorter, simpler and less verbose than other high level programming languages . It has a well designed built in features and standard library as well as access to third party modules and source libraries. Python works or runs across all platforms, windows, linux/UNIX, Mac OS, it also works on microcontrollers used in appliances, toys, remote controls, embedded devices, and other similar devices.
Python can be written in any text editor if you have the interpreter also installed. Many developers use special programs that are called Integrated Development Environments (IDEs)/ IDEs help with finding syntax and exception errors. Examples are Microsoft Visual Studio Code, Eclipse, PyCharm, Spyder
To start writing programs in python, you have to first download the installation package compactible with your OS and computer specs from python official website, https://www.python.org/downloads/. After downloading, then install by clicking the .exe file you downlaoded.
Python is a flexible and dynamic language that you can use in different ways. You can use it in script mode when you want to interpret an entire file of statements or application program.
There are several ways to access python’s command line depending on the operating system installed in your computer. If you are using a windows OS, you can start python by clicking on its icon or menu item on the start menu. If you are using GNU/Linux, UNIX, MAC OS systems, you have to run the terminal tool and enter the python command to start your session.
To see how python works, you can use the print command to print the universal program “Yo Good”
Open python’s command line
At the >>>> prompt, type the following: print(“Yo Good”)
Press enter to tell python that you are done with your command. Very quickly, the command line window will display Yo Good on the following line.
To exit from python, you can type any of these commands: quit() or exit() or Ctr+Z+Enter
Python syntax refers to the set of rules that defines how much users and the system should write and interpret a python program. First thing to note are pythin keywords, these are reserved words in python that should not be used as variable, constant, function name, or identifier in your code. Words such as: and, break, continue, global, import, else, except, if, while, from, return, or, etc (check the documentation on www.python.org for more keywords).
Next, is identifier; which is a name given to a function, class, variable, module, or other objects that you’ll be using in your python program. Here are python naming conventions you should be aware of:
An identifier can be a combination of uppercase letters, lowercase letters, underscores, and digits (0-9).
Special characters such as %, @ and $ are not allowed within identifiers
An identifier should not begin with a number
Python is a case sensitive language and this behaviour extends to identifiers
Python keywords can’t be used as identifiers
You can use underscores to separate multiple words in your identifier.
Python allows the use of quotation marks to indicate string literals. You can use single, double, or triple quotes but you must start and end the string with thesame type.
Then, we have statements, which are instructions that a python interpreter can execute. When you assign a value to a variable, say pet_var = “lion”, you are making an assignment statement, you just assigned the string “lion” to the variable “pet_var”. In python there are other statements such as the if statements, while statements, etc.
Python unlike other languages uses indentation to structure its block of codes. Indentation makes python codes more readable and understandable.
Comments are necessary in every programming language for every programmer as you write your codes. Comments are very handy when you have to review or revisit your program. It will also help others who may come across or look through your code to understand. In python you can use the “#” to start a comment. For multi line comments, you can use the triple quotes.