grader.py 657 B

12345678910111213141516
  1. import weather
  2. def on_run(code, output, properties):
  3. f = weather.get_temperature("Miami, FL")
  4. c = (f - 32) / 1.8
  5. if not output:
  6. return "You have to print the temperature in Farenheit and Celsius."
  7. elif "weather.get_temperature(\"Miami, FL\")" not in code:
  8. return "You need to request Miami's current temperature."
  9. elif "celsius = (fahrenheit - 32) / 1.8" not in code:
  10. return "You are not converting the temperature to celsius using the right formula."
  11. elif (str(f)+"\n" in output) or (str(c)+"\n" in output):
  12. return True
  13. else:
  14. return "You must print Miami's temperature in both scales."