Python was first released in 1991 by Guido Van Rossum and has since become one of the most popular programming languages in the world. Van Rossum once said that he named the language after the comedy – Monty Python – and that he was looking for a hobby programming project that would keep him occupied around Christmas. He ended up creating Python, a high level, interpreted programming language that is used worldwide for many different programmes, including web development, scientific computing, data analysis, artificial intelligence and more!
A main reason why Python is so popular is because it’s extremely easy to learn and use, it’s syntax reads like English, meaning that it’s straightforward and a great choice for beginners. It’s also very versatile and has a large standard library of useful tools and modules which can save developers time and effort when building applications.
def is_over_5(number):
# function to check if parameter is greater than 5
if number > 5:
return "Number is greater than 5"
else if number == 5:
return "Number is 5"
else:
return "Number is less than 5"
# Test the code
is_over_5(3)
is_over_5(5)
is_over_5(7)
Almost any kind of application can be built using Python, since it is a general purpose language. There are a lot of useful frameworks which allow Python developers to easily branch into different types of software. For example, Django and flask are extremely powerful for building the backend of websites, NumPy and SciPy allow for scientific computing, Pandas and pyplot are used to visualise data and AI models can be built and trained using libraries like TensorFlow and Sciki-learn.
Pandas, NumPy, SciPy
TensorFlow, scikit-learn
Django, Flask
Another reason why Python is a great choice is because of its strong community. Not only are there many resources available online to learn Python, there are also forums, tutorials, extensive documentation and numerous conferences for dedicated developers! With all these different resources, it makes it very easy to help and get support when learning to code.
Pythons ease and readability has given guidelines for writing software in Python. Tim Peters, a long-time contributor to the Python community, created The Zen of Python. You can access this by running import this in a Python interpreter or script and running it.
import this
The Zen of Python (shown below) contains 19 principles that emphasise writing your scripts by following these specific guidelines. These include ‘Beautiful is better than ugly’, ‘Explicit is better than implicit’ and ‘There should be one – and preferably only one – obvious way to do it’. These guidelines help ensure that Python code is simple, readable and practical, making it easy to understand and maintain.
'''The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!'''