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. Required fields are marked *

You May Also Like

Daily News

GitHub’s new feature “passwordless authentication” aims to increase account security and provide a smoother user experience. By opting for the “Enable passkeys” option within...

Artificial Intelligence

Scientists from Japan used AI deep learning to discover new geoglyphs in the Arid Peruvian coastal plain, in the northern part of Peru’s Nazca...

Artificial Intelligence

The Tokyo Institute of Technology and other organizations have announced the start of development of highly performing generative artificial intelligence using the Fugaku supercomputer,...

Artificial Intelligence

Japanese researchers announced that AI ChatGPT technology has succeeded in the annual national doctor’s exam. The AI chatbot, which has advanced speech features that...