Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære 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.

Opgave

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øsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 5
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

close

bookChallenge: Identify High Turnover Departments

Stryg for at vise menuen

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.

Opgave

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øsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 5
single

single

some-alt