← All Python interview questions

Bucket engagement scores into segments

EasyFunctions & LogicDeloitteAccenture

The growth team scores every learner from 0-100 and wants those scores collapsed into four named segments for a dashboard.

Write a function segment(score) that returns:

  • "Champion" for 80 and above
  • "Engaged" for 60-79
  • "At Risk" for 40-59
  • "Dormant" below 40

For any score outside 0-100, return "Invalid".

Practising alone only goes so far — our live cohorts pair Python and Pandas depth with dashboards, agentic analytics projects and mock interviews.

Explore the program