Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Identify High Turnover Departments | Reporting and Insights for HR
Python for HR Specialists

bookChallenge: Identify High Turnover Departments

In your HR data analysis journey, you have learned how to work with dictionaries to store and process structured information, such as employee or department data. Iterating through a dictionary allows you to access each key-value pair, making it possible to examine or manipulate the data based on specific criteria. Conditional logic, such as using an if statement, helps you filter out only the information that meets certain requirements. This skill is essential when you want to identify trends or outliers—like departments with unusually high turnover rates.

1234567891011121314
# Example: Identifying departments with turnover above a threshold department_turnover = { "Sales": 0.15, "Engineering": 0.08, "HR": 0.12, "Marketing": 0.09 } threshold = 0.10 for department, turnover in department_turnover.items(): if turnover > threshold: print(f"{department} has high turnover: {turnover:.0%}")
copy

When presenting the results, it is helpful to format your output so that high-turnover departments stand out clearly. You can print each qualifying department on a new line, including both the department name and its turnover rate as a percentage. Using string formatting, such as f"{value:.0%}", will display the turnover rate in an easy-to-read percentage format, making your HR reports more professional and actionable.

Aufgabe

Swipe to start coding

Write a function that prints the names and turnover rates of all departments with turnover above the given threshold.

  • Iterate through each department and its turnover rate in the department_turnover dictionary.
  • For each department, check if the turnover rate is greater than threshold.
  • If the turnover rate is above the threshold, print the department name and turnover rate as a percentage using string formatting.

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 3. Kapitel 5
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

Suggested prompts:

Can you explain how the string formatting works in this example?

What other criteria could I use to filter departments?

How can I modify the code to show departments with low turnover instead?

close

bookChallenge: Identify High Turnover Departments

Swipe um das Menü anzuzeigen

In your HR data analysis journey, you have learned how to work with dictionaries to store and process structured information, such as employee or department data. Iterating through a dictionary allows you to access each key-value pair, making it possible to examine or manipulate the data based on specific criteria. Conditional logic, such as using an if statement, helps you filter out only the information that meets certain requirements. This skill is essential when you want to identify trends or outliers—like departments with unusually high turnover rates.

1234567891011121314
# Example: Identifying departments with turnover above a threshold department_turnover = { "Sales": 0.15, "Engineering": 0.08, "HR": 0.12, "Marketing": 0.09 } threshold = 0.10 for department, turnover in department_turnover.items(): if turnover > threshold: print(f"{department} has high turnover: {turnover:.0%}")
copy

When presenting the results, it is helpful to format your output so that high-turnover departments stand out clearly. You can print each qualifying department on a new line, including both the department name and its turnover rate as a percentage. Using string formatting, such as f"{value:.0%}", will display the turnover rate in an easy-to-read percentage format, making your HR reports more professional and actionable.

Aufgabe

Swipe to start coding

Write a function that prints the names and turnover rates of all departments with turnover above the given threshold.

  • Iterate through each department and its turnover rate in the department_turnover dictionary.
  • For each department, check if the turnover rate is greater than threshold.
  • If the turnover rate is above the threshold, print the department name and turnover rate as a percentage using string formatting.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 3. Kapitel 5
single

single

some-alt