Learning Python From Scratch: Part 1

Hello everyone I’m Elif! I am one of the Sisterslab’s Women in Tech Academy project participants supported by Toplum Gönüllüleri Vakfı. The project aims to empower 25 women between the ages of 20–28 with software training for 3 months and seek their participation in the workforce in the sector. You can find more information about the project at this link: https://sisterslab.co/women-in-tech-academy/

In this series of medium articles, I will try to cover python from scratch. And in this part, we will have a sneak peek of what python is, what we can develop with it, and how we can start using it.

Python is a perfect language if you want to start programming because it is easy to write and read. And there are a lot of things you can do with it. So without further ado, let’s begin!

What is Python?

Python was conceived in the late 1980s by Guido van Rossum. And the first version was released in 1991 as Python 0.9.0. Because it is a “general-purpose” language, you can use python for various applications. And python is a high-level language, which means our computers first need to convert our code into byte code and then machine code and execute it, which is the type of code that our machines can understand; Full of zeros and ones. In python, while we run our code, each line that we write is interpreted into machine code which makes python an interpreted language.

What we can develop with it?

With python we can develop various applications here are just a few examples of them. You can manipulate and process data using Python to get results from it. You can visualize this data and write forecasting applications using various algorithms. You can create websites with frameworks such as Django, and Flask. You can do web scraping by pulling data from the web and developing games using Pygame.

Things you can develop with python

Hello World!

If you are familiar with the programming languages, you probably know what we learn first, YES! it is saying hello to the world. In python for that, you just need to write this one line of code.

Printing Hello World!

Data Types and Variables

In python, there are various types of built-in data types. These data types make it easier to store our values. These types are:

  • Numeric (Integer, Float, Complex Numbers)
  • Dictionary
  • Boolean
  • Set
  • Sequence Type (String, List, Tuple)

But today we are going to focus more on the basic and more used ones like integer, float, boolean, and string.

The integer data type is used for storing negative and positive integer (whole) numbers.

The float data type is used for real numbers with floating points. If we are doing calculations with decimals it would be better for us to use this data type.

And the boolean data type is used for storing the truth value of an expression. So it can store two values: True or False.

And last but not least is the string data type. This is the data type we use for storing text and characters.

As shown in the code snippet below we can assign a new value to a variable very easily with the data types that we learned. We only need to write “variable name = value” and then we can use these variables later on in our code.

Data Types and their Classes

Changing Variables Value

In python, you can easily handle changing data types and values. As in the code example below, you can perform this operation by re-assigning a value as if you were redefining previously defined data.

Changing data types and values

Multiple Assignments in Python

Another convenience we have in Python is that we can perform multiple assignments at the same time. In this way, we can make all the assignments we need to do with a single line of code. Even if these assignments are of different data types.

Multiple Assignments in Python

Global and Local Values

Another thing in Python is local and global variables. The scope of the variables varies according to the function or location. For example, in the code snippet below, the value has been reassigned and changed in the first function. Therefore, the output of the Func1() method is the value that has changed in the function, 500. However, since there is no variable named value in the Func2() method, the value defined in the global area is used, and therefore the output of the method is 600, the first value of value.

Global and Local Variables

In other articles in my Python from scratch series, we’ll learn to use operators, typecasting, decision structures, and much more. I hope you liked this article. Have a nice day!

You can find all the resources I used in my article here!

Wikipedia — Python

Python: Notes for Professionals

Learn Python 3 From Scratch — Educative





Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Elif Çelik

Elif Çelik

A Computer Engineer who is interested in Machine Learning and Deep Learning.