Daily Coding Challenge - Thermostat Adjuster

Tell us what’s happening:

I’m trying to complete the coding challenge, but none of the tests are being submitted. It outputs the correct string when the temperature and target are equal or not but also keeps returning none, I’m assuming temp’s data type when I remove the “return temp”. My issue is that when I add the return temp, it shows the temp variable’s new value but still doesn’t complete the challenge. What can I do?

Your code so far

def adjust_thermostat(temp, target): 
  if temp > target:
      print("cool")
  elif temp == target:
      print("hold")
  elif temp < target:
      print("heat")
  return temp
print(adjust_thermostat(68, 72))
print(adjust_thermostat(75, 72))
print(adjust_thermostat(72, 72))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0

Challenge Information:

Daily Coding Challenge - Thermostat Adjuster
https://www.freecodecamp.org/learn/daily-coding-challenge/2025-09-15

Hi @19livlah and welcome to our community!

What value is your function returning with this call?

You are getting an extra temp value but in the test case they doesn’t want that value to print. So you need to handle the function correctly to return the correct value.

Mod Edit SOLUTION REMOVED

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge. How to Help Someone with Their Code Using the Socratic Method

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

1 Like
heat
68

I’m not sure where to go from here…I’m quite new to Python

and which of those two is the value returned from the function?

you can do print('output', adjust_thermostat(68, 72)) if it helps identifying it

the tests are testing the returned value

The value of temp is returned from the function.

I just figured it out! Instead of printing the strings, I should’ve returned them and removed the return temp.

1 Like