Back to Freecodecamp

Challenge 194: 2026 Winter Games Day 15: Freestyle Skiing

curriculum/challenges/english/blocks/daily-coding-challenges-python/697a49e9860d24853adef67f.md

latest2.4 KB
Original Source

--description--

Given a trick name consisting of two words, determine if it is a valid freestyle skiing trick name.

A trick is valid if the first word is in the list of valid first words, and the second word is in the list of valid second words.

  • The two words will be separated by a single space.

Valid first words:

"Misty"
"Ghost"
"Thunder"
"Solar"
"Sky"
"Phantom"
"Frozen"
"Polar"

Valid second words:

"Twister"
"Icequake"
"Avalanche"
"Vortex"
"Snowstorm"
"Frostbite"
"Blizzard"
"Shadow"

--hints--

is_valid_trick("Polar Vortex") should return True.

js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Polar Vortex"), True)`)
}})

is_valid_trick("Solar Icequake") should return True.

js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Solar Icequake"), True)`)
}})

is_valid_trick("Thunder Blizzard") should return True.

js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Thunder Blizzard"), True)`)
}})

is_valid_trick("Phantom Frostbite") should return True.

js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Phantom Frostbite"), True)`)
}})

is_valid_trick("Ghost Avalanche") should return True.

js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Ghost Avalanche"), True)`)
}})

is_valid_trick("Snowstorm Shadow") should return False.

js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Snowstorm Shadow"), False)`)
}})

is_valid_trick("Solar Sky") should return False.

js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Solar Sky"), False)`)
}})

--seed--

--seed-contents--

py
def is_valid_trick(trick_name):

    return trick_name

--solutions--

py
def is_valid_trick(trick_name):
    valid_first = ["Misty", "Ghost", "Thunder", "Solar", "Sky", "Phantom", "Frozen", "Polar"]
    valid_second = ["Twister", "Icequake", "Avalanche", "Vortex", "Snowstorm", "Frostbite", "Blizzard", "Shadow"]

    words = trick_name.split(" ")
    first, second = words
    return first in valid_first and second in valid_second