Python-Introduction to the Programming
Language
Python is a snake but we
are not taking about a snake here. We
are talking about a programming language.
Qualities
Python is:
·
Interpreted
·
Object Oriented
·
High-level programming language.
·
Multi-Purpose Programming Language
·
Scalable
What is it used for?
Python is used for the following:
·
Developing Websites -backend
·
Data Analysis
·
Data Visualization
·
It was nice that PHP was for a long time helped with
free resources and many docs.
History
Python was invented was conceived’ in the 1980’s by Guido
Van Rossum from Netherlands. It was launched in 1990s.
Reason why Python’s sudden Popularity
Python is not a new language but suddenly it has become
popular. There must be reasons (I was wondering) for which it has become
popular.
Listed below are some advantages of Python:
·
Python has an active Community
·
Some Well-known Sponsors. –
When a programming language has great sponsors, it is big advantage. Like C# is
backed by Microsoft, Java was backed by Sun, etc. Python is used by Google
since 2006. There are various resources created by Google for Python.
·
Python Uses Big Data- Big
Data is used in cloud computing and this another reason Python is popular.
·
Great Libraries- Python
has libraries that can save you time.
Python is popular with Developers and this is usually because
of efficiency. This is true for any language.
Here are three main reasons why Python is
popular with Developers:
·
Productivity Increased-This
means you write fewer lines of code to perform an operation as
compared to Java and C++.
·
Code is easy in The
code easy in comparison to Java. So same job or task saves resources
when done in Python.
·
IOT- Python is used in
IOT or Internet of Things.
Python is great for web development.
Web Development
There are a few frameworks for Web development using
Python.
Most Commonly used:
·
Django -A
great Python framework.
·
Flask-Another Popular framework of Python
Installing in Windows:
Many of us are using Windows and other Operating
systems.
Pre requisites of installing Python:
1. Windows
10 with Admin Privileges
2. Command
Prompt (already in Windows)
Steps to Install Python in Windows:
1. Select
Version of Python to use.
2. Download
Installer
3. Run
Executable
Great, you have installed. This article is not showing
every step since you should now bye now know how to install. Do not take errors
as some curse. Rather you learn when you make mistakes. I remember in 2003,
where technological resources were scarce and technology was not promoted by
government then.
I had to figure out how to Install PHP, Apache and
mySQL separately and connect them together until Xampp came. If you are a PHP
developer and starting from trying to install Xampp. Hold it, no install the
traditional way. That is if you want
to be a great developer.
Missing something
After Install:
1. Go
to the place python.exe was installed and click it.
2. You
will see a black command Prompt like window. Something written like: “Python
3.7.3…...”. Yes, you got Python installed.
3. Test
if PIP is installed after finding in the directory.
4. “PIP
Help”
If you are still stuck in Installation then visit this
link.
The Main code
We try to figure out how we start. It is very simple.
We add two simple numbers, integers.
But let us go quickly to Python basics
Data types:
·
Numbers: int, float, Complex numbers
·
List
·
Tuple-a sequence of numbers which cannot be
altered.
·
Strings
·
Sets
·
Dictionary
·
Boolean types
Python Code to add two numbers:
x = 5
y = 10
print (x + y)
We see how python solves a Quadratic Equation.
The formula for quadratic equation is: ax2
+ bx + c=0.
a, b and c are all co efficient and real numbers.
The discrimant ,D=b2–4ac.
Solutions of x are:
·
If D is positive, we have two solutions.
·
IF D is negative no solutions.
·
If zero repeated solutions.
The above is from maths in school.
We go the code:
from math import sqrt
check_input = True
while check_input:
a, b, c = eval(input("Please enter the a, b, c coefficients of your
quadratic equation: "))
try:
float(a), float(b), float(c)
check_input = False
except ValueError:
print ("Please make sure the coefficients are real numbers and try
again")
check_input = True
disc = sqrt(b*b-4*a*c)
if disc >=0:
x1 = (-b+disc)/(2*a)
x2 = (-b-disc)/(2*a)
print
("The roots of the equation are:", x1, x2)
else:
print
("The equation has no solutions").
It is seen that the code needed for a certain operation
in python is less for than in other languages.
Applications of Python:
Where are we applying Python? First time I heard about
Python, reminded me of the Movie” Anaconda”.
We people in the IT Sector keep giving catchy names:
Yahoo!
CakePHP
FuelPHP
Aura.
Application areas of Python:
Here list of areas where Python is applied:
·
Web Development
·
AI
·
Software
·
Desktop GUI
·
OS ddevelopment
·
Image Processing-like GIMP, Scribus,
Paintshop Pro.
There are well-known Software using all or parts
of Python:
·
YouTube lot of Python code
·
Google
·
Reddit
·
Instagram
·
Quora
This is interesting and all the more to start learning
Python.
But you do have to learn Programming first.
Conclusion:
Python happens to be the trend in Programming,
something like when PHP was around 2000.
Our previous post on programming talks about languages
to be learned initially.