Intro to Python
Tags: python, beginners, programming
Published: 2023-06-18 22:09:08

## A Brief History

Python was released in 1991 by Guido Van Rossum. During team meetings in the early days of Python, the title "Benevolent Dictator for Life" was bestowed upon Van Rossum. This venerable title has since been reserved for only a small group of giants of the open-source software development world.

[History](https://python-history.blogspot.com/2009/01/brief-timeline-of-python.html), [BDFL](https://www.artima.com/weblogs/viewpost.jsp?thread=235725)

![Guido Van Rossum](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/usyigogbpzivb2t1si7h.jpg)
[GVR](https://gvanrossum.github.io/)

And in case you were wondering: Yes, the Python programming language was named after _Monty Python_, the British comedy sketches. Because, with Python, coding is fun! 

[Python name](https://docs.python.org/3/faq/general.html#why-is-it-called-python)



![Monty Python meme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xtt3lmgtsbwb0uyqdhke.jpeg)

[MP meme](https://programmerhumor.io/python-memes/image-generator-that-let-you-see-how-you-would-look-like-as-a-monty-python-character/)


Python was created with usability, efficiency and simplicity in mind. Python developer Tim Peters expands on this mindset with the "Zen of Python" ... 

> "Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Readability counts."

[Zen of Python](https://peps.python.org/pep-0020/)

## What is Python, anyway?

Python is a multipurpose, server-side programming language that is rapidly gaining popularity. It's known for its ease of use, versatility and vast array of libraries. Python is used by Youtube, NASA, Pixar, Netflix and Facebook-- just to name a few. It is one of the top programming languages that developers use, are currently learning, or are requested to know by potential employers. 

[Companies using Python](https://codingnomads.co/wp-content/uploads/2019/06/PythonCompanies.png), [Stack Overflow Ranking](https://survey.stackoverflow.co/2022/?utm_source=social-share&utm_medium=social&utm_campaign=dev-survey-2022), [jetBrains Ranking](https://www.jetbrains.com/lp/devecosystem-2020/), [PYPL ranking](https://pypl.github.io/PYPL.html)

Python is known for it's ease of use. The syntax and grammar of Python are specifically designed to be as straightforward, intuitive and concise as possible. It is often recommended as the first programming language to learn for beginners. And, it is especially easy to pick up for developers that have familiarity with other languages.

Python is also known for it's versatility . It has great extensibility and versatility because of its modules. Extensibility is how much a framework can extend to another system and how easy this is to implement. There are many different modules, libraries and packages that can be used with Python. Whatever it may be that you want to build with Python, there is most likely already a built-out foundation for it. 

## What does it look like to code in Python?

Now that you know all about it, let's see what it's like to actually code with Python. Here's a small astrology program, named Bob, that will ask for a user's birthday, and respond based on that information.

```
# Let's build an astrology program!

# print a greeting
print('Hello astrologer!')
# ask user for name
print('What is your name? ')
# assign user name to a variable
my_name = input()
```

The `print()` method will print any value passed into it. Here, we print a greeting and ask for a users name. At this point, we can assign a variable to `input()`, and whatever the user inputs will be saved as their name.


```
# app introduces itself
print('Hi ' + my_name + '! My name is Bob.')
print('My birthday is 06/18/2023. That means I am a Gemini!')
# ask user for birthday
print('When is your birthday? (Please input in this format: 00/00/0000) ')
# assign user birthday to variable
my_birthday = input()
```

Now, we have our users birthdate information. But, anything passed into `input()` will automatically be stored as a string. To use this data in the form of a number, we'll have to convert the datatype. 

We can use the `int()` method to convert a string to an integer. We also only need certain positions from the input in order to determine the user's birthday and month. We can use bracket notation to access particular values of the input, based on their indexes. 


```
# create month and day variables
my_month = int(my_birthday[0:2])
my_day = int(my_birthday[3:5])
```

Now we have stored the users birthday information data as numbers, and can use it as such.

```
# determine user's sign based on month and day variables
if my_month == 1 and my_day < 20 or my_month == 12 and my_day > 21:
    my_sign = 'Capricorn'
elif my_month == 1 and my_day > 19 or my_month == 2 and my_day < 19:
    my_sign = 'Aquarius'
elif my_month == 2 and my_day > 18 or my_month == 3 and my_day < 21:
    my_sign = 'Pisces'
elif my_month == 3 and my_day > 22 or my_month == 4 and my_day < 20:
    my_sign = 'Aries'
elif my_month == 4 and my_day > 21 or my_month == 5 and my_day < 21:
    my_sign = 'Taurus'
elif my_month == 5 and my_day > 22 or my_month == 6 and my_day < 21:
    my_sign = 'Gemini'
elif my_month == 6 and my_day > 22 or my_month == 7 and my_day < 23:
    my_sign = 'Cancer'
elif my_month == 7 and my_day > 24 or my_month == 8 and my_day < 23:
    my_sign = 'Leo'
elif my_month == 8 and my_day > 24 or my_month == 9 and my_day < 23:
    my_sign = 'Virgo'
elif my_month == 9 and my_day > 24 or my_month == 10 and my_day < 23:
    my_sign = 'Libra'
elif my_month == 10 and my_day > 24 or my_month == 11 and my_day < 22:
    my_sign = 'Scorpio'
elif my_month == 11 and my_day > 23 or my_month == 12 and my_day < 22:
    my_sign = 'Sagittarius'
```

These statements are known as conditions. Depending on the conditions of the users birthdate data, we can assign a variable to store the appropriate sign. 

```
# respond with user sign
print('You are a ' + my_sign + '! I knew you were crazy.')
print('Wanna know your moon and rising?')
answer = input()

if answer == 'yes':
    print('Please enter your birth time and location!')
else:
    print('Typical ' + my_sign + '. Whatever!')
```

There you have it! In just a few moments, we've created a program that takes in data about a user and responds based on that data.


## How does Python stack up to other languages?
**Pros**

- Usability: Python is easy to learn and use, and is quite powerful considering.

- Extensibility: Python has many different libraries to support different kinds of applications.

- Community: Python has a large community with many resources available online. This may be especially important for beginners. 

- Scalability: Python is can be used for small, simple apps or it can be used for large projects by big companies.

- Great for backend: Although Python is a general language, it is particularly useful for backend. Data science, automation, machine learning and AI are all areas of strength for Python.

[Pros of Python](https://codingnomads.co/why-learn-python/), 
[More Pros of Python](https://www.youtube.com/watch?v=Ou_hSDxzjMI)


So far, we've only looked at the advantages of using Python. As it is a popular language, it's no surprise there are so many. 

But, just like any programming tool, there are upsides and downsides. In the case of Python, there are aspects of it that may not be ideal for a given developer, depending on their specific goals. 

**Cons**

- Possibly too general: while in many ways this is an advantage of Python, it can also be a disadvantage. Sure, you can build pretty much anything with Python. But just because you can, doesn't mean you should. In particular, Python is weaker than other languages when it comes to mobile apps and 3D rendering. If your goal is build a game, mobile app, or website, Python may not be the best choice. Other languages are more specialist than Python, and may be a better choice for one specific project. 

- Slowness: Python is dynamically typed, and as such, it is read slower. It has a "global interpreter lock", meaning that only one thread of code can by read by the interpreter at a time. While this difference in speed may not be particularly dramatic compared to other languages, it is something to consider. 


## Conclusion

In conclusion, there are many advantages to Python. It is versatile, intuitive and in high demand. If you are planning to work in data science, automation or machine learning, it may be especially great to use. Otherwise, if you are planning to work in an area that would be better suited by another specialized programming language, you can always focus on one language now and learn Python later on. For a software developer, Python is a great skill to have in your repertoire.


![Python "so hot right now" Zoolander meme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w9xvp6y3ysevoso8pu3r.png)

Ready to get started? [Here's](https://www.w3schools.com/python/python_exercises.asp) a few simple exercises to help you dip your toes into Python.