Welcome
Friends,
Before
we begin our programming, let's get used to with the various basic data
types.
1. Integer (int): It takes the whole number including negative values for example 0, 1, 2, 3 etc as well as a
negative number like -1, -2, -3, ...
If you notice, when we
added these two number, it simply concatenated the numbers. We first need to
convert these numbers into strings and then add it.
2. Float (float): It can take decimal
values, for example, 3.14, 7.99, 15.23 etc.
3. String (str): It is a sequence of
characters, for example, "Hello", "Welcome to Python world"
Note: you can assign a
string variable in either single quotes (like ‘Hello’) or double quotes (like “Hello”)
4. Boolean: It takes only two
values, i.e. True or False
5. List: It is a collection of
objects or values. It is denoted by []
To add, use the command,
append
To remove an element
from the list using the keyword remove
6. Tuple: It is similar to list
but once it is created it cannot be changed and it is denoted in the () bracket.
7. Dictionary (dict): It is used to store
data in key-value pair and it is stored in {}
Hope, now we can get some basics with the
data types and in our next blog, we will write some simple programs. Stay tuned.








No comments:
Post a Comment