Posts

Showing posts from October, 2022

Python Data Types - float

Image
Number with decimal point which is obviously not a whole number come under float data type. e.g., Rates of petrol, diesel are generally shown in decimal points.  petrol = 110.34 diesel = 94.52 let’s check type() to confirm types of above prices, Another use of float data type is to store long number. long numbers can be stored using exponential notations. e.g., a=854600000000000000000000000000000 reading above number is quite difficult to read at first seen. If we learn understand exponential notations it is to read long numbers We can write above number in exponential like a=8.546e+32 or 8.546e32 as there are 32 digits after decimal point e+32 is written. As we know we can declare long integer number using int data type. But reading or remembering them is not so easy. We can save them in shorter format like exponential notations. Like below shown we can convert long int numbers into exponential format. Here, we have converted integer number into exponential...

Python Data Types - int

Image
           To store numerical values, we have 3 data types in python out of which we are going to see int i.e., integer data type here.   Keyword:  int   Numeric value without any fractional part in it can be consider as number with int data type. For example: 0, 55, -32, 8694848, 100 these are numbers with int data type.   1.32, 5.3, 0.4 such numbers cannot be considered as int type.   To initialize a variable with int value we can just write variable name equal to sign (=) and then integer value. e.g. ball_count= 554 distance_travelled= 98   Note: Like other programming languages we don’t have to mention data type keywords before variable name in initialisation. And also, we do not have to declare a variable separately in python.     There are 4 forms in which we can represent an integer value in python. 1.       Decimal Form (base -10) 2.      Binary Form (base-2) 3. ...

Python Data Types - Overview

The python language supports vast number of data Operations. To learn all these important and dynamic range of features we must learn all of its inbuilt data types. There are some major types of data we know numeric, text, sequential, sets, etc. To handle all these different types of data we have different data types specified in python. 1.     For Numeric type of data, we have a.     int b.     float c.      complex 2.    For text type of data, we have a.     str 3.    For sequences we have a.     list b.     tuple c.      range 4.    For data where mapping is required, we have a.     dict 5.    For Set types, we have a.     set and b.     frozenset 6.    For Boolean values, we have a.     bool 7.    Fo...