Skip to content

Commit bb804f9

Browse files
unknownunknown
authored andcommitted
Adding the actual Dictionary_Lab.py file I should have.
1 parent 741febd commit bb804f9

2 files changed

Lines changed: 90 additions & 1 deletion

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
def printDonorList(donors):
2+
for donor in donors:
3+
print donor
4+
5+
donors = [["Anne", 50, 100, 150],
6+
["Bob", 25, 50],
7+
["Debbie", 5, 15, 30],
8+
["Eric", 65, 75, 100],
9+
["Fran", 250]]
10+
11+
userInput = raw_input("(1) Send a Thank You (2) Create a Report: ")
12+
13+
if userInput == "1":
14+
name = raw_input("What is the name? ")
15+
while name.lower() == "list":
16+
printDonorList(donors)
17+
name = raw_input("What is the name? ")
18+
19+
found = False
20+
for donor in donors:
21+
if name == donor[0]:
22+
found = True
23+
donationUser = donor
24+
print found
25+
26+
if found == False:
27+
newDonor = [name]
28+
donors.append(newDonor)
29+
donationUser = donors[-1]
30+
31+
money = raw_input("Show me the money: ")
32+
donationUser.append(money)
33+
34+
printDonorList(donors)
35+
36+
37+
38+
39+

Students/Danielle_Marcos/session04/dictionary_lab.py

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,54 @@
2020
else:
2121
print False
2222

23-
mydict2 = {"0"}
23+
list1 = range(15)
24+
list2 = []
25+
26+
for i in list1:
27+
print i
28+
print hex(i)
29+
list2.append(hex(i))
30+
print list2
31+
32+
myzip = zip (list1,list2)
33+
print myzip
34+
35+
mydict2 = dict(myzip)
36+
print mydict2
37+
38+
mydict3 = mydict.keys()
39+
print mydict3
40+
41+
42+
for i in mydict.values():
43+
print i
44+
if 't' in i:
45+
print i
46+
print i.count('t')
47+
48+
s2 = set([2,4,6,8,10,12,14,16,18,20])
49+
s3 = set([3,6,9,12,15,18])
50+
s4 = set([4,8,12,16,20])
51+
52+
print s2
53+
print s3
54+
print s4
55+
56+
print s3.issubset(s2)
57+
print s4.issubset(s2)
58+
59+
s5 = set(['P','y','t','h','o','n'])
60+
print s5
61+
s5.add('i')
62+
print s5
63+
64+
fs = frozenset(('m','a','r','a','t','h','o','n'))
65+
print fs
66+
67+
print s5.union(fs,)
68+
print s5.intersection(fs,)
69+
70+
71+
72+
73+

0 commit comments

Comments
 (0)