-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path05_DataTypes.py
More file actions
49 lines (47 loc) · 2.23 KB
/
05_DataTypes.py
File metadata and controls
49 lines (47 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Data Types
# A. Numeric
a =10
b= 9.45
c= 9+45j
print("The value of a: ",a," and it type is: ",type(a))
print("The value of b: ",b," and it type is: ",type(b))
print("The value of c: ",c," and it type is: ",type(c))
print("The real value of c: ",c.real," and imaginary value of c: ",c.imag)
#***************************************************************************************************
# B. String
a='This string with single quote'
b="This string with Double quote"
c='''This string with triple quote'''
print(a,"the type is: ",type(a))
print(b,"the type is: ",type(b))
print(c,"the type is: ",type(c))
#***************************************************************************************************
# C. List
numList=([1,2,3,4])
print(numList," type is: ",type(numList))
combined=(['Shreyas',7,556,9,'India', 'Asia',True])
print(combined," type is: ",type(combined)) #print complete list
print(combined[0]) #print index i'th element
print(combined[2:]) #print after index i'th element
print(combined[1:4]) #print between index i'th ot j'th element
print(combined[:1]) #print between index i'th ot j'th element
#***************************************************************************************************
# D. Tuple
element=('Jhon',59,'p', [98,454,64], 'python')
print(element," type is: ",type(element))
#***************************************************************************************************
# E. Boolean
a=True
b=False
print(a," type of a is: ",type(a)," and it int value: " ,int(a))
print(b," type of a is: ",type(b)," and it int value: " ,int(b))
#***************************************************************************************************
# F. Set
setElement={'Shreyas',64,9, 6+9j, 4,'Python', 'Java',False}
print(setElement," type is: ",type(setElement))
# setList={'Shreyas',64,9, 6+9j, [4,'Python', 'Java'],False}
# print(setList," type is: ",type(setList))
#***************************************************************************************************
# G. Dictonary
dictElement={1:'Shreyas',2:56,3:'python'}
print(dictElement," type is: ",type(dictElement))