Working on variable, string and number

imaginor-labs 12 May 19
Technology Comments

This is the continuation of series of blog post on getting started to data science using python . So today will explore the building blocks of python with emphasis on variable strings and numbers . Simply you can consider variable as like the pocket in your shirt just with using (=) you can assign value to a variable.

Variable – simply which can occupy memory and store value and the best thing about python is you do not have to explicitly declare type to a variable .
Simply you can consider variable as like the pocket in your shirt just with using (=) you can assign value to a variable.

imag1

Lets check the type of the variable using typefunction:

imag2

Here you did not have to explicitly mentioned the type.

You can also assigns same value to multiple variable simultaneously:

imag3

Strings :

String is a very popular among the data types in python you can create a string by quoting the characters as like :

imag4

The easiest way to explore string is by simply

imag5

str. + tab
Will explore a few of the function in string :

imag6

String formattingoperator is one of the best features in python with of % symbol where you can structure your code accordingly as below , again you can make use of other option with % + Tab

imag7
imag8

To know more how the function would work

imag9

Converting an integer to string :

imag10

More operation on string :

imag11

Numbers :

Example on numbers :

imag12
imag13
imag14

Floor division //, modulus %, power **

imag15
imag16
imag17
imag18

So this are few example you can try it out on your notebook . Stay tune Happy Learning and sharing !!

Comments:

Add a Comment:



Recent Posts: