Connect with us

Hi, what are you looking for?

Python For Data Science (2)
Python For Data Science (2)


Python For Data Science (2)


In this tutorial, we going to learn data types, type conversations, 4 operations. Before start, if you don’t read Python for data science (1) you should read this tutorial. Let’s start learning Python.

What Is Data Types?

used to inform the computer how to use the data. In languages ​​such as C # and Java, you have to write these structures while specifying the data. In Python, the data type is automatically determined according to the value.

  • List
  • Tuple
  • Dictionary
  • String -> Text
  • Int -> integer
  • Bool -> True or False (Logic)
  • Float -> Decimal Number

I gave some data types above, there are a few more data types besides these, we learned other simple data types. It is enough to know this concept now, we need to learn 4 operations and type conversion.

4 Operations In Python

In this section, we will look at concepts such as addition, multiplication, division, subtraction, getting mod, exponentiation.

1 – Addition

Just like in mathematics, + is used for addition. only here you can addition strings as well as integer numbers.

Above, we gather 2 integer variables after that, we write this sum on the console. Now we’ll look at adding decimals.


above, we gather 2 decimal numbers, so the console will display a decimal result instead of an integer result. Now, we going to learn to gather 2 strings.


above, we collect the two strings and as a result, “XY” is output without spaces.

2 – Multiplication

The multiplication is indicated by * instead of the x symbol. It’s almost the same as multiplication in math, except programming can also a string can also be multiplied by integers.

Above, we multiplied two whole numbers. In the same way, we can multiply 2 decimal numbers.


Now, let’s do the string multiplication, which is not in mathematics but is also in programming.


here the string statement is printed twice, if I set the “a variable” as 3, it is printed 3 times. In other words, when the strings are multiplied, it occurs as much as the value it is multiplied.

Division And Subtraction

We will look at division and subtraction it is exactly the same as mathematics, everything will be understood in the example below.

Getting Mode And Exponentiation

We will first look at the “exponentiation” that we are familiar with from mathematics, then we look at the “getting mode” slightly unfamiliar modification operator.


In the above process, 120 by 21 is divided and the remainder is written on the screen.

Note: You can use // to divide without a remainder.

Type Conversation (String, Int, Bool, Float)

Now we’ll look at how to switch data types, a of important information, not all data types are transformed into each other. Let’s start this part.

above, we have converted several data types to each other, but more importantly, different types of data can be received with this type of conversion. Let’s ask the user for an integer data type.

If you want to print the data type on the screen, you can use the type () function.



Click to comment

Leave a Reply

Your email address will not be published.

You May Also Like

Game Development

In this article, we will generate a movement script for FPS games in Unity. We’ll cover all the mechanics like camera control, crouching, and...

Game Development

In this article, we are going to look at how to use SQLite RDBMS in Unity 3D. After this article, you’ll be able to...

Machine Learning

In this article, we are going to learn how to build regression models with PyCaret in Python. If you don’t have any experience with...


In this article, we will make a simple login system in SwiftUI. After this article, you will be able to make a custom login...