-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlessonSetsAndDict.py
More file actions
36 lines (26 loc) · 838 Bytes
/
lessonSetsAndDict.py
File metadata and controls
36 lines (26 loc) · 838 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
#sets and dictionaries
#sets don't keep position and will not repeat when printed
#good to check if something is there, not where it is
# sets = {"element0","element2","element5.6","element4"}
# print(sets)
# if "element1" in sets:
# print("yeah")
# countrylist = []
# for i in range(5):
# country = input("what is your country: ")
# countrylist.append(country)
# countryset = set(countrylist)
# print(countryset)
# print(countrylist)
# if "us" in countryset:
# print("attended")
# # Dictionaries:
# # Dictionaries have a key and a value pair
# # Dictionary = {"Key":"Value","Key2":"Value2",...}
# countrydictionary = {}
# for country in countrylist:
# if country in countrydictionary:
# countrydictionary[country] += 1
# else:
# countrydictionary[country] = 1
# print(countrydictionary)