-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01 - BASIC PYTHON DATA TYPES
More file actions
23 lines (16 loc) · 1.26 KB
/
01 - BASIC PYTHON DATA TYPES
File metadata and controls
23 lines (16 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# the basic datatypes availabe in python are followed:
# 1. int = integer(ex. 1, 4,59,0,2,-42,-4 ) all the number from - infinity to + infinity (but all of them are whole numbers)
# 2.float = floating points (or decimal numbers) (ex. 1.0 ,340.32, 0.0, -0.4320, ect) all the number from - infinity to + infinity (but all of them are decimal numbers)
# 3.bool = boolean it is a special data type which can only have either True or False
# 4.str = string litrally anything given between quetotation is known as a string .(ex. 'code hub', "5323", "0423.42", '''True''') we can use single quotation (''), double ("") or triple quotation(''' ''')
# so these are the four basic datatypes available in python so let's see some example program
# creating 4 variables and storing different datatypes in them
num = 432 #integer
decimal = 20.423 #float
boolean = True #boolean
string = 'litrally anything... inside this quotation' #sting
#let's see their datatypes in program , we use type() to know the datatype of a variable
print(type(num)) - gives <class int> as output
print(type(decimal)) - gives <class float> as output
print(type(boolean)) - gives <class bool> as output
print(type(string)) - gives <class str> as output