-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdict.py
More file actions
44 lines (38 loc) · 680 Bytes
/
dict.py
File metadata and controls
44 lines (38 loc) · 680 Bytes
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
'''##create a dictionary
d = dict()
#d[city] = state
##7 elements
l = []
l['key'] = 1
d['NYC'] = 'New York'
d['Queens'] = 'New York'
d['Brooklyn'] = 'New York'
d['Philly'] = 'PA'
print(d)
''''''
for i in d:
print(i), print(d[i])
print(f'{i}: {d[i]}')''''''
##only print PA. KEy is Philly
print(d['Philly'])'''
'''s = "this is a sample string"
l = s.split('i')
print(s.split())
print(len(l))'''
'''###Read a file####
filename = open('test.txt', 'r')
#print(filename)
r = filename.read(3)
#print(r)
filename = open('file.txt', 'a')
filename.write(r)
'''
x = 10
def add():
global x
y = 9
result = x + y
x = result
print(result)
print(x)
add()