Skip to content

Commit 8e6a625

Browse files
authoredJul 7, 2019
Add files via upload
1 parent a52cf5e commit 8e6a625

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
 
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
4+
There are eight native datatypes in Python.
5+
6+
Boolean
7+
Numbers
8+
Strings
9+
Bytes & Byte Arrays
10+
Lists
11+
Tuples
12+
Sets
13+
Dictionaries
14+
15+
Let us look at how to implement these data types in Python.
16+
"""
17+
18+
#Boolean
19+
number = [1,2,3,4,5]
20+
boolean = 3 in number
21+
print(boolean)
22+
23+
#Numbers
24+
num1 = 5**3
25+
num2 = 32//3
26+
num3 = 32/3
27+
print('num1 is',num1)
28+
print('num2 is',num2)
29+
print('num3 is',num3)
30+
31+
#Strings
32+
str1 = "Welcome"
33+
str2 = " to Edureka's Python Programming Blog"
34+
str3 = str1 + str2
35+
print('str3 is',str3)
36+
print(str3[0:10])
37+
print(str3[-5:])
38+
print(str3[:-5])
39+
40+
#Lists
41+
countries = ['India', 'Australia', 'United States', 'Canada', 'Singapore']
42+
print(len(countries))
43+
print(countries)
44+
countries.append('Brazil')
45+
print(countries)
46+
countries.insert(2, 'United Kingdom')
47+
print(countries)
48+
49+
#Tuples
50+
sports_tuple = ('Cricket', 'Basketball', 'Football')
51+
sports_list = list(sports_tuple)
52+
sports_list.append('Baseball')
53+
print(sports_list)
54+
print(sports_tuple)
55+
56+
#Dictionary
57+
#Indian Government
58+
Government = {'Legislature':'Parliament', 'Executive':'PM & Cabinet', 'Judiciary':'Supreme Court'}
59+
print('Indian Government has ',Government)
60+
#Modifying for USA
61+
Government['Legislature']='Congress'
62+
Government['Executive']='President & Cabinet'
63+
print('USA Government has ',Government)

0 commit comments

Comments
 (0)
Please sign in to comment.