-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDifferent datatypes.py
More file actions
49 lines (35 loc) · 1.46 KB
/
Different datatypes.py
File metadata and controls
49 lines (35 loc) · 1.46 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
# Title
print("\t\t\tDifferent Datatypes\n")
# Creating Variables of All types
# Creating list of strings
list_str = ['15', '10', '100', '45']
# Creating list of integer
list_int = [15, 10, 100, 45]
# Creating list of float
list_float = [15.1, 10.09, 100.45, 45.78]
# Displaying 'list_str' Datatype
print("The datatype of 'list_str' is:", type(list_str))
# Displaying elements inside the list
print("The elements inside list are:", list_str)
# Displaying Datatype of elements inside list
print("The datatype of elements inside list is:", type(list_str[0]))
# Displaying 'list_int' Datatype
print("\nThe datatype of 'list_int' is:", type(list_int))
# Displaying elements inside the list
print("The elements inside list are:", list_int)
# Displaying Datatype of elements inside list
print("The datatype of elements inside list is:", type(list_int[0]))
# Displaying 'list_float' Datatype
print("\nThe datatype of 'list_float' is:", type(list_float))
# Displaying elements inside the list
print("The elements inside list are:", list_float)
# Displaying Datatype of elements inside list
print("The datatype of elements inside list is:", type(list_float[0]))
# Sorting message
print('\nThe lists will now be sorted')
# Sorting 'list_str' variable
list_str.sort()
print("\nThe sorted list of variable (list_str) is:", list_str)
# Sorting 'list_int' variable
list_int.sort()
print("The sorted list of variable (list_int) is:", list_int)