i) int : Same as other programming language, int is a number without fractional part.
For example : 124, 54, 678 are of int type.
But 124.0, 124.1 are not integer ( int ). Although 124.0 is same as 124, but
still 124.0 is not an int type.
For example : 124, 54, 678 are of int type.
But 124.0, 124.1 are not integer ( int ). Although 124.0 is same as 124, but
still 124.0 is not an int type.
ii) float : float is a number with fractional part and that fractional part can be
zero as well. For example, in int data type, i had mentioned that,
124.0 is not an int data type but a float data type. More examples of
a float type is 1.2, 3.28347965, 23.23233.
zero as well. For example, in int data type, i had mentioned that,
124.0 is not an int data type but a float data type. More examples of
a float type is 1.2, 3.28347965, 23.23233.
iii) String : ideally, string is a list of characters. But, python does not have a
char data Type. "a" is also a string.
Example : " ", "82", "12.234", "I am a string".
iv) List : A list is a collection of data types . One cool thing about list is that
it can have mixed data types in collection.
For example : [1, 2, "3", "python3", 23.9874]
v) Tuple : Tuples are nothing but constant lists which cannot be modified.
For example : (1, 2, "3", "python3", 23.9874)
vi) dictionary : as the name suggests, dictionary is a collection of key value pair defined
as "key" : "value" stored in {}
as "key" : "value" stored in {}
Example :{"one" : 1, "two" : 2, "three":3}
vii) Sets : These are same as mathematics' sets which can have no
repetitions and are ordered.
No comments:
Post a Comment