Initial work
This commit is contained in:
13
CS1032/practical-2023-10-25/dicts
Normal file
13
CS1032/practical-2023-10-25/dicts
Normal file
@@ -0,0 +1,13 @@
|
||||
counts = { 'chuck': 1, 'annie': 42, 'jan': 100 }
|
||||
|
||||
for key in counts:
|
||||
if (count := counts[key]) > 1:
|
||||
print(key, count)
|
||||
|
||||
|
||||
|
||||
lst = list(counts.keys())
|
||||
print(lst)
|
||||
lst.sort()
|
||||
for key in lst:
|
||||
print(key, counts[key])
|
||||
Reference in New Issue
Block a user