Update solutions for dictionaries
Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
This commit is contained in:
parent
dd36861233
commit
1313fe8d42
|
@ -68,7 +68,16 @@ print("-" * 50)
|
|||
# Aufgabe 5 & 6 mit Funktion
|
||||
|
||||
def print_salary_list(data, col_width=8):
|
||||
heading = "Name".ljust(col_width) + "Gehalt"
|
||||
"""Print a formatted list of employees and their salary.
|
||||
|
||||
Expects a a dictionary as the first argument:
|
||||
|
||||
{
|
||||
"name": salary,
|
||||
...
|
||||
}
|
||||
"""
|
||||
heading = "Name".ljust(col_width) + " Gehalt"
|
||||
print(heading)
|
||||
print("-" * len(heading))
|
||||
for name, salary in data.items():
|
||||
|
@ -76,7 +85,7 @@ def print_salary_list(data, col_width=8):
|
|||
|
||||
print_salary_list(salaries_new, 10)
|
||||
print("-" * 50)
|
||||
print_salary_list(salaries_all, 10)
|
||||
print_salary_list(salaries_all, col_width=10)
|
||||
|
||||
print("-" * 50)
|
||||
|
||||
|
|
Loading…
Reference in New Issue