Mehmet Nazlıay
2 min readJan 18, 2021

--

Hello Everyone,

While I was learning Python for Data Science, I took some notes. I want to share these notes with you. I hope this is helpful for you.

Python is simpler than most other programming languages so you can learn it easily.

We can use print() to print text or other things on the screen.

When we use the len() function, we can see how many characters are in “Data Science”.

We define the variable x as Python in the first line. We are slicing with x[0] and the result is ‘P’. Result is ‘th’ in the third line. In the last line the result is ‘hon’.

We can take anything from the user with the input() function. We ask the user ‘ What is your name?’ and define the variable name on above.

When we can see the first code block, the variable “number” is created and in the forth line we can see the type of the “number” variable as int. If we create a variable like “string1”, we see the type of variable as string. If we want a string variable, we can create a variable like “string2".

Also we can change type of variable. For instance we can change the variable “number” from integer to string and we can the change “string1” from string to integer. However we can not change the variable “string2” from string to integer. Because it can not be integer.

Data Structures

Lists

Lists are a part of the core Python language and lists can hold arbitrary elements.

In this code block we can see list structure. We create the variable “list1”. “list1” is a list structure and it contains [80,45,”50",”variable”,4,3]. We can see type in the second line. Also we can use slice like in third line. Also we count variables in it like the forth line.

In this code block we create variable “languages” which contains [“Python”,”Java”,”C#”]. If we want to change “Python” to “New_Python”, we can do that like in the second code line.

List Methods

I want to mention some list methods such as append, remove, insert, pop.

When we want to add a new variable to the variable “languages”, we can use the append method like in the second line. Also we can add new values with insert but we have to write the index number like in the the fourth line. In the fourth line we want to add “R” to the zero index.

We can remove any value with the remove method like that in the sixth line. We can remove the value “R” from list “languages”. Also we use the pop method. In the eighth line we write the number of index we want to remove.

Thanks to your time, Have a nice day.

--

--