Challenge: Debugging and Improving Code Logic
Task
Swipe to start coding
Your task is to debug and improve the heart rate tracking system to ensure it efficiently assigns users to the correct heart rate zone.
- Use an
if-elif-elsestructure instead of multipleifstatements for better efficiency and readability. - Ensure the logic correctly categorizes heart rate values and avoids redundant conditions.
- Assign the correct heart rate zone based on the given heart rate.
Max Zoneif the heart rate is 150 or above.Cardio Zoneif the heart rate is between 100 and 149, inclusive.Fat-Burning Zoneif the heart rate is between 60 and 99, inclusive.Resting Zoneif the heart rate is below 60.- Store the assigned zone in the
zonevariable. - Ensure all
if,elif, andelsestatements end with a colon (:).
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 3
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 6.67
Challenge: Debugging and Improving Code Logic
Swipe to show menu
Task
Swipe to start coding
Your task is to debug and improve the heart rate tracking system to ensure it efficiently assigns users to the correct heart rate zone.
- Use an
if-elif-elsestructure instead of multipleifstatements for better efficiency and readability. - Ensure the logic correctly categorizes heart rate values and avoids redundant conditions.
- Assign the correct heart rate zone based on the given heart rate.
Max Zoneif the heart rate is 150 or above.Cardio Zoneif the heart rate is between 100 and 149, inclusive.Fat-Burning Zoneif the heart rate is between 60 and 99, inclusive.Resting Zoneif the heart rate is below 60.- Store the assigned zone in the
zonevariable. - Ensure all
if,elif, andelsestatements end with a colon (:).
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 3
single