This article was published as part of the Data Science Blogathon
Today's blog is about starting the journey to Python programming. so this blog is dedicated to all those who are from any domain, whether they are students, active employees, mechanical engineers who are willing to learn programming and newbies. Today, Python is the most used programming by tech giants like Google, Netflix, Facebook. Looks interesting, then let's start.
What is python?
Python is a high-level object-oriented programming language that was created by Guido van Rossum. It is also called a general purpose programming language, since it is used in almost every domain we can think of, as mentioned below:
- Web development
- Software development
- Game development
- IA y ML
- Analysis of data
This list can continue as we go along, but let's see why Python is so popular in the next topic.
Why programming in Python?
They may have a question in mind, Why python? Why not another programming language?
So let me explain:
IEEE Spectrum List of Major Programming Languages 2021. The list of programming languages is based on popularity.
How do we start?
Now, in the age of the digital world, there is a lot of information available on the internet that could confuse us, believe me. what we can do is follow the documentation, which is a good starting point. Once we are familiar with the concepts or terminology, we can delve into this.
Below are references where we can start our journey:
Official Web site: https://www.python.org/
Udemy course: https://www.udemy.com/course/python-the-complete-python-developer-course/
YouTube: https://www.youtube.com/watch?v = _uQrJ0TkZlc
I hope you are now excited to get off to a good start, so you might be wondering where we can start coding correctly so that there are many options available in the markets. we can use whatever IDE we feel comfortable with, but for those who are new to the world of programming, below I list some of the IDEs for python:
1) Visual Studio: https://visualstudio.microsoft.com/
2) PyCharm: https://www.jetbrains.com/pycharm/
3) Spyder: https://www.spyder-ide.org/
4) Atom: https://atom.io/
5) Google Colab: https://research.google.com/colaboratory/
Real world examples:
1) NASA (National Aeronautics and Space Agency): One of NASA's shuttle support contractors, United Space Alliance, developed a workflow automation system (WAS) which is fast. Internal resources within the critical project stated that:
"Python allows us to tackle the complexity of programs like WAS without getting bogged down in the language".
NASA also published a website (https://code.nasa.gov/) where there is 400 open source projects that use Python.
2) Netflix: There are several projects on Netflix that use Python as follows:
- Central Alert Gateway
- Chaos gorilla
- Safety jumpsuit
Among all projects, regional failover is the project they have, since the system reduces the interruption time of 45 minutes to 7 minutes at no additional cost.
3) Instagram: Instagram also uses Python extensively. They have built a social platform to share photos using Django, what is a web framework for python. What's more, they can successfully upgrade their framework without any technical challenge.
Python Programming Applications:
1) Web development: Python offers different frameworks for web development like Django, Pyramid, Flask. This frame is known for its safety, flexibility and scalability.
2) Game development: PySoy and PyGame are two Python libraries used for game development.
3) Artificial intelligence and machine learning: There are a large number of open source libraries that can be used when developing AI applications / ML.
4) Desktop GUI: Desktop GUI offers many sets of tools and frameworks with which we can create desktop applications. PyQt, PyGtk, PyGUI are some of the GUI frameworks.
How to become a better programmer:
The last, but more important, is how to improve in the programming you choose is practice, the practice, the practice. Practical knowledge is only acquired by playing with things, so you will be more exposed to real world scenarios. Consistency is more important than anything else because if you practice it for a few days and then you didn't do anything, when you start again it will be difficult to practice consistently. So I ask them to learn by doing projects to help them understand how things are done and the important thing is to have fun at the same time..
Approach to follow to master Python:
"The beginning is the end and the end is the beginning". I know what you are thinking. It's basically a famous quote from a web series called “Dark”. Now, How does it relate to python programming?
If you did google, youtube or any development community, You will find that people explain how you can master programming in, Let's say, a number “x” of days and things like that.
Good, reality is like the infinity logo that we can see above. In the field of programming, the domain does not exist. It is simply a trial and error process. For instance. Yesterday I was writing code where it tried to print a value from a variable before declaring it inside a function. There he had seen a new bug called “UnboundLocalErrorException“.
Then, the important thing to keep in mind is that programming is an amazing field. Throughout his entire career, you will see new errors and exceptions. Just remember the quote: "Practice makes the perfect man".
Now here is the main part. Which approach to follow to master Python programming?
Good, here it is:
Paso 1: Start with a program “Hello World”
If by chance you learned some programming languages, then i'm sure you know what i'm talking about. The program “Hello World” it's like a tradition in the developer community. If you want to master any programming language, this should be the first line of code we should look for.
Simple Hello World program in Python:
Paso 2: Start learning about variables
Now, once we master the program “Hello World” and Python, the next step is to master variables in python. Variables are like containers that are used to store values.
Variables in Python:
my_var = 100
As you can see here, we have created a variable called “my_var” to assign a value of 100 to the same.
Paso 3: Start learning about data types and data structures
The next outpost is learning about data types. Here I have seen that there is a lot of confusion between data types and data structures. The important thing to note here is that the data types represent the data type. For instance. and Python, we have something like int, string, float, etc. Those are called data types as they indicate the type of data we are dealing with.
While data structures are responsible for deciding how to store this data in a computer's memory.
String data type in Python:
my_str = "ABCD"
As you can see here, we have assigned a value “ABCD” a una variable my_str. This is basically a string data type in Python.
Data structure in Python:
This is known as a dictionary data structure in Python.
One more time, This is just the tip of the iceberg. There are many data types and data structures in Python. To give a basic idea about data structures in Python, here is the complete list:
Paso 4: Start learning about conditionals and loops
In any programming language, conditionals and loops are considered one of the pillars.
Python is not an exception either. This is one of the most important concepts that we must master.
if(x < 10): print("x is less than 10") elif(x > 10): print("x is greater than 10") else: print("Do nothing")
As you can see in the example above, we have created what is known as an if-elif-else ladder
for i in "Python": print(i)
The above code is basically an example of a for loop in Python.
Once you start programming with Python, You will see that if we missed any whitespace in Python, Python will start giving some errors. This is known as indentation in Python. Python is very strict with indentation. Python is created with a mindset to help everyone become a verbose programmer. This indentation scheme in Python is introduced in an early PEP (Python Improvement Proposal) of Python.
Then, Some additional resources are included that may help you dig deeper:
Python projects: https://realpython.com/tutorials/projects/
Coding challenge: https://www.hackerrank.com/
Here are some useful links to help you become more familiar with Python.
Hope you like this post and have an idea of what Python is shortly, which will give you some guidance on IP so that you can begin your journey into the world of programming. This is just the tip of the iceberg. There are much more advanced concepts like generators, decorators, POO, etc. to dominate. But nevertheless, to master those concepts, we must first master the basics.
Share this with your friends and colleagues.
The media shown in this article is not the property of DataPeaker and is used at the author's discretion.