Initialer Import der Synology Scripts

This commit is contained in:
root
2026-08-05 08:43:57 +02:00
commit 5e32a7c411
404 changed files with 79932 additions and 0 deletions
@@ -0,0 +1,30 @@
"""Exercise 3:
1.)
Write a function that takes a dictionary as an input.
The function then iterates over all values and counts
how many "Students" are in the dictionary.
(See the dict "d" below)
2.)
Write a function that iterates over all key, value pairs
of the dictionary "d" and only print the name of the students.
"""
def exercise1(dct):
num_students = 0
for val in dct.values():
if val == "Student":
num_students += 1
return num_students
def exercise2(dct):
for key, val in dct.items():
if val == "Student":
print(key, "is a student")
d = {"Oskar": "Student", "Jan": "Instructor", "Thomas": "Student"}
print(exercise1(d))
exercise2(d)