Introduction to Python
Published: 2023-02-19 20:53:16

Data science, big data, IoT, AI name it, the world is moving into the intelligent side and we have no choice but to move with it. As tech enthusiasts, we have to be on our toes to keep up with the changing technology in the world. The above technologies are formed on the foundation of Python. Up to this point, we can agree that Python is an important programming language. So let us delve into this interesting language and know more about it.
Python is an object-oriented dynamic programming language that is interpreted; it uses objects to organize software designs rather than functions. One interesting thing about this language is that there is no declaration of variables or methods in the source code. You may ask, what is the advantage of not declaring variable forehand? Well, the types of data are checked at run-time rather than compile-time. this functionality makes the code brief and flexible. The shorter the code, the happier the developer. Python is an open source and therefore allows the developers to share ideas and learn from one another. The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python website, https://www.python.org/, and may be freely distributed.
Now that you have an idea about Python, let us look at the installation process. The installation process has been made easier and much easier for Linux users as the OS comes with the latest version of Python. The preferred installer for python is pip. Starting with Python 3.4 is included by default with the Python binary installers. The standard packaging tools are all designed to be used from the command line. Using the following commands, you can install the latest version of a module and its dependencies from the Python Package.
`python -m pip install MyPackage`
One can also install a specific version in the command line using the following command:
`python -m pip install SomePackage==1.0.4    # specific version`
Existing modules can also be upgraded using the following command:
`python -m pip install --upgrade SomePackage`
The creation of virtual environments is done through the venv module. 
The Python interpreter is usually installed as /usr/local/bin/python3.11 on those machines where it is available; putting /usr/local/bin in your Unix shell’s search path makes it possible to start it by typing the command:
`python3.11`
On Windows machines where you have installed Python from the Microsoft Store, the python3.11 command will be available. If you have the py.exe launcher installed, you can use the py command.
To install the py.exe go to [](https://docs.python.org/3/download.html) and download the appropriate exe file according to your computer's specification.

## Open the installed interpreter using the following command:
`python3.11`
This runs the interpreter directly

## Run the following command see the version
`import sys


print("User Current Version:-", sys.version)
`

## Now you can run a simple code on the interpreter. Example:

`c=b=a`
`b = 2`
`a = 4`
`c`
The answer will be 
`6`
From here you can run more mathematical simple operations to get more familiar with the language.

## Python Syntax
Now we do not want to be frustrated the first time we are using this programing language, at least not by syntax error. This calls us to have a basic knowledge of the dos and don'ts of this amazing language.
1. Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses.
2. Python is indentation sensitive, that means the right indentation should be used for relevant and smooth flow of the program. Lines of code in the same category should be inline with each other. For example:

```
def degree_year(cy,ey) #method to check number of years in school
    return(cy-ey)
degree_year(2023,2017)

```

From the above code, the definition of the method is in line with the function used to call the defined method. If you put the second line of code in the same level as the other two, an error will occur. 
3. Commenting is done using the hashtag character "#" to indicate the beginning of the comment. Comments are writings within the code that are not executed but give further information about the particular line of code.
4. Python is case-sensitive. For class names, the name should begin with uppercase and for method names it should start in lowercase followed by uppercase for the beginning of the next word given that the name is made up of two words. For instance:

`def className #method name is Carmel case`

`class Nairobi #class name begins with an upper case`

For more identifiers and the rules that they follow, you can visit [](https://www.scaler.com/topics/is-python-case-sensitive-when-dealing-with-identifiers/)

## What is Python used for

1. Creation of web applications.
2. Python can be used alongside software to create workflows.
3. Read and modify files when used alongside a database
4. Python can be used to handle big data and perform complex mathematics.
5. Python can be used for rapid prototyping, or for production-ready software development.
6. Python is used in data science and deep learning through Jupyter and Collab notebook environment.

## Conclusion
For more information, you can visit the following websites for resources :

1. [(https://www.w3schools.com/python/python_intro.asp)]
2. [(https://www.geeksforgeeks.org/check-the-version-of-the-python-interpreter/)]
3. [(https://docs.python.org/3/tutorial/interpreter.html)]

Happy Coding!!!