Python 101: The Ultimate Python Tutorial For Beginners.
Tags: python, beginners, opensource, machinelearning
Published: 2022-04-24 20:39:38


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3vbpeimqx0v9vxq1bzu6.png)
#History of Python
<p>Python programming language was created in 1980s by Guido van Rossum at The Netherlands as inspired by ABC programming language and SETL. Ever since the popularity of Python as a choice of language as soared highly and is today ranked as No. 1 by most reputable rankings. This is attributed to the fact that Python is easy to learn and its application areas are wide.
Python truely is a beginners dream language.
</p>
#Application Areas Of Python
<p>Python has gain popularity stemming from the fact that the application are almost limitless. The following are examples of fields where Python are used:</p>

1. Automation: writing shell scripts to automate everyday repetitive tasks by system admins.
2. Data Analysis: Owing to its rich libraries and functions in areas of mathematics and statistics, Python has been hugely embraced by the Data science communities.
3. Web Development: Frameworks like Django and Flask provide the perfect tools for web developers to design beautiful and functional websites and web applications.
4. Machine Learning: this is the newest area of application of Python which is rapidly growing. Pytorch and Tensorflow are the most important 


#Getting Started
<h1> Installation Guide</h1>
<p> Now let's dive right in on how to get Python working in your PC, Linux or Mac. 
<h2>Installing Python</h2>
The latest version of Python at the time of publihing blog is 3.10.4. and this is how to get in your local development environment.

For Linux and Mac Users, the operating systems comes with an installation of Python by default whereas in Windows PCs you have to manually download the Python set up and run it. 
<h3>Installing on Windows</h3>
Follow this link [Python 3](https://wiki.python.org/moin/BeginnersGuide/Download)to download the latest version of interpreter in your development environment.
After running the set up, check if the installation was succesfull by running the following in your favourite command line interface.

```
python3 -V
```
Note: When installing on Windows, make sure to check the box indicating to "Add Python 3.x to PATH" so that the interpreter is avialable system wide.
<h3>Installation on Mac OS</h3>
In order to Install the latest Python interprter, first install Xcode from the AppStore by running the following command from the command line interface.

```
xcode-select --install
```
It is advisable to install Homebrew environment by following the guide here [](https://brew.sh/). After succesfully installing Homebrew, run the following Brew command:

```
> brew update
> brew install python3
```
<h3>Installing on Linux</h3>
In Order to install Python Interpreter on Linux use the following commands:

```
sudo apt install python3 #For Debian and Ubuntu Distros
```

```
sudo yum install python3 # RedHat and CentOS Distros
```

#Python Devlopment Environment.
A Python programmer can utilize both command line interface or the use of intergrated development environment.
To run Python cli, go to your favorite terminal and 
type `python3`, on pressing enter you will be directed to the interpreted as indicated by `>>>`
you can run python code in this console. To exit the interface type `exit()`.

Alternatively, and most importantly you can run the Python code from an IDE. Some of the highly recommended IDEs are:

- VS Code
To install VS Code in your operating system follow the following guide: 
- PyCharm
Installation guide for Pycharm is found here.

#Concise guide to Python Syntax and Elements with Examples

Note: All python code files are saved with .py extension names.

Python programming language is known for its clean and simple syntax. i.e. this is the Python's Hello World code.
   `print("Hello World!") #write the line and save as helloworld.py `
As you can note from the line of code, Python do not use semi-colons at the end of each line of code.
<h3>Variables </h3>
Variables are used to store and pass values in a program. Variables in Python are not strongly typed meaning the type of value stored by a variables can dynamically change throughout the program execution.

The acceptable ways to name a variable are that the variable names are case sensitive, i.e. 'First' and 'first' variable names are different and store different values. 
Value assignment to a variable is done by the use of equals signs.

```
First='Naomie'
first='Ruth'
```
<h4>Variable Types</h4>
The following lines of code depict the different variable types in Python programming.

```
my_bool = True #Boolean
my_int = 12    #Integer
my_string ="Name"  #String
my_float = 14.85    #Float
my_complex_number = 56+4j #Complex Numbers
my_list = ["mercedes", "redbull", "Hass"] #List
my_dict = {"country" : "France", "worldcups" : 2} #dictionary
```
<h3>Indentation</h3>
Unlike other languages which uses curly braces, Python utilizes indentation to define scope and start and end of functions.

```
def prime_function():
    a=input("Enter the number to test: ")
    print(a)
prime_function()
```
<h3>Comments</h3>
Comments in any programming language are important as they make the code readable and easy to debug.
To leave comments on a Python code you use the the `#` symbol.
`print("Hello World!") #This will output Hello World!`
Multiline comments are done by using # symbol at the beginning of each line.

<h3> Operators In Python</h3>
The following are the common operators in Python:
<h4>Arithmetic Operators</h4>

```
print(5 + 2) #Addition
print(5 - 2) #Subtraction
print(5 * 2) #Multiplication
print(5 / 2) #Division
print(5 // 2) #Floor Division
print(5 ** 2) #Exponentiation
print(5 % 2) #Modulus
```

#Next Series..
<p> In the next part of the series we will look into more details and intricacies of Python Programming.

Happy Coding. Ciao For now.