WEEKDAY CHALLENGE: Thermostat Adjuster
This time round I didn't want to give you something too challenging, but I thought we should stretch your coding muscles. Don't forget to post a screenshot of your code passing all 6 tests and explain your thinking.
Challenge starts below this line of text.
=====
Given the current temperature of a room and a target temperature, return a string indicating how to adjust the room temperature based on these constraints:
  • Return "heat" if the current temperature is below the target.
  • Return "cool" if the current temperature is above the target.
  • Return "hold" if the current temperature is equal to the target.
Your code should pass the following tests:
1. adjust_thermostat(68, 72) should return "heat".
2. adjust_thermostat(75, 72) should return "cool".
3. adjust_thermostat(72, 72) should return "hold".
4. adjust_thermostat(-20.5, -10.1) should return "heat".
5. adjust_thermostat(100, 99.9) should return "cool".
6. adjust_thermostat(0.0, 0.0) should return "hold".
=====
Goodluck
~ ascriptkiddie
2
2 comments
Bree Kagwe
5
WEEKDAY CHALLENGE: Thermostat Adjuster
powered by
The Black Widow Community
skool.com/bree-1280
Get Paid To Hunt Bounties, Solve CTF's & Compete For Gadgets.
It's all here.
Want to become an ethical hacker? We built this community for you.
Build your own community
Bring people together around your passion and get paid.
Powered by