🚀 Think you’ve got what it takes for a career in Data? Find out in just one minute!

Python programming for dummies – Episode 1

-
3
 m de lecture
-
Python programming for dummies - Episode 1

Are you interested in programming? Would you like to learn the basics of a commonly used programming language in an intuitive way? Then you've come to the right place! After reading this, you'll know all the basics of programming in Python! From variables and functions to loops, Python's tools will hold no secrets for you.

The python story

Unlike other languages, Python is designed to be much more concise and expressive, requiring less time, effort and lines of code to perform the same operations.

The language is highly appreciated for its simpler approach to programming basics. It continued to evolve over the years, until December 2008. That year, a cleaner, more modern version of the language was released: version 3.0. This has been the only supported version since January 2020.

Today, Python has over 8.4 million users worldwide, making it the second most widely used language behind Javascript.

 

💡Related articles:

Folium: Discover the open source Python library
Matplotlib: Master Data Visualization in Python
Python Crash Course: Get started
Mastering Machine Learning in Python: Data-Driven Success
Python Programming for Beginners – Episode 3
Django: All about the Python web development framework

Why learn Python programming?

Python offers many advantages:

  • Extensive libraries: a large collection of classical numerical methods, plotting and data processing tools.
  • These avoid the need to reprogram complex or tedious elements, such as curve plotting, Fourier transforms or fitting algorithms.
  • Easy to learn: Python’s syntax is straightforward and the code is easy to read. For example, you can learn to draw curves in just a few minutes.
  • Efficiency: Python numerical modules are computationally efficient. But it goes without saying that very fast code becomes useless if you spend too much time writing it. Python aims for fast development and execution times.

The most popular data-science libraries to learn Python programming

One of Python’s major assets is the number and diversity of available libraries. Many are used for Data Science
Among them, the most popular are

  • The Pandas library, dedicated to working with data tables, also known as “dataframes”. It enables both data manipulation and analysis.
  • The Numpy library, dedicated to numerical calculation. It facilitates the manipulation of numerical tables, notably by enabling the application of various calculation functions.
  • The Scikit-learn library, dedicated to machine learning. Among other things, it can be used to implement methods for data preparation and modeling.
  • The Tensorflow library is dedicated to machine learning and, more specifically, Deep Learning. It was created in open source by Google’s Artificial Intelligence team.

Let’s get down to business!

Let’s start by learning about the different types of variables in Python. This is just the beginning, but in a few weeks you’ll have all the basics for programming in Python.

Variables

A variable is used to store data that will be used by the program. It can store a number, a string, a Boolean, a list or any other type of data.

Each variable has a name, and the equal sign = is used to assign a value to a variable. After initial assignment, the value of a variable can be updated to new values as required.

Base types

We’ll now take a look at the data types used in Python.

Numeric types

Python supports both integers and floating-point numbers. There is no type declaration to distinguish them; Python distinguishes them by the presence or absence of a decimal point.

Strings:

To store textual data, we use character strings, which can be instantiated using different syntaxes. (single, double or triple quotation marks).

A chain is an immutable object, and its contents cannot be modified. However, new chains can be created from the original chain.

Booleans:

Booleans are the result of logical operations and have two possible values: True or False.

Here’s a list of operations that apply to Booleans:

Containers:

Python provides a number of efficient container types in which collections of objects can be stored.
We’re going to look at the main containers: lists, tuples, sets and dictionaries (but there are many more…).

1- Listes:

A list is an ordered collection of objects. These objects can be of different types.

2- Tuple:

Tuples are immutable lists.

3- Set:

A set is an unordered container of unique elements.

4- Dictionary:

A dictionary is in fact an efficient array that maps keys to values. It is the most important container in Python.

Important notes

  • Keys can be of different types
  • A key must be immutable

Operations managed by dictionaries:

Conclusion

So, in this first article, we’ve looked at the basics of Python programming, through the instantiation and use of variables of various types and the basic operations that can be performed on them.

See you next week for a new section on instructions. We’ll also look at functions and how to load a dataset! In the meantime, if the wait is unbearable, our Data Analyst, Data Scientist and Data Engineer courses are the perfect place to start and deepen your Data Science learning!

Facebook
Twitter
LinkedIn

DataScientest News

Sign up for our Newsletter to receive our guides, tutorials, events, and the latest news directly in your inbox.

You are not available?

Leave us your e-mail, so that we can send you your new articles when they are published!
icon newsletter

DataNews

Get monthly insider insights from experts directly in your mailbox