curriculum/challenges/english/blocks/daily-coding-challenges-python/69738771fb5a7b8b24cca2a2.md
Today is Groundhog Day, in which a groundhog predicts the weather based on whether or not it sees its shadow.
Given a value representing the groundhog's appearance, return the correct prediction:
true (the groundhog saw its shadow), return "Looks like we'll have six more weeks of winter.".false (the groundhog did not see its shadow), return "It's going to be an early spring."."No prediction this year.".groundhog_day_prediction(True) should return "Looks like we'll have six more weeks of winter.".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(groundhog_day_prediction(True), "Looks like we'll have six more weeks of winter.")`)
}})
groundhog_day_prediction(False) should return "It's going to be an early spring.".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(groundhog_day_prediction(False), "It's going to be an early spring.")`)
}})
groundhog_day_prediction(None) should return "No prediction this year.".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(groundhog_day_prediction(None), "No prediction this year.")`)
}})
groundhog_day_prediction(" ") should return "No prediction this year.".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(groundhog_day_prediction(" "), "No prediction this year.")`)
}})
groundhog_day_prediction("True") should return "No prediction this year.".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(groundhog_day_prediction("True"), "No prediction this year.")`)
}})
def groundhog_day_prediction(appearance):
return appearance
def groundhog_day_prediction(appearance):
if appearance is True:
return "Looks like we'll have six more weeks of winter."
if appearance is False:
return "It's going to be an early spring."
return "No prediction this year."