curriculum/challenges/english/blocks/daily-coding-challenges-python/697a49e9860d24853adef67f.md
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.
Valid first words:
"Misty" |
|---|
"Ghost" |
"Thunder" |
"Solar" |
"Sky" |
"Phantom" |
"Frozen" |
"Polar" |
Valid second words:
"Twister" |
|---|
"Icequake" |
"Avalanche" |
"Vortex" |
"Snowstorm" |
"Frostbite" |
"Blizzard" |
"Shadow" |
is_valid_trick("Polar Vortex") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Polar Vortex"), True)`)
}})
is_valid_trick("Solar Icequake") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Solar Icequake"), True)`)
}})
is_valid_trick("Thunder Blizzard") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Thunder Blizzard"), True)`)
}})
is_valid_trick("Phantom Frostbite") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Phantom Frostbite"), True)`)
}})
is_valid_trick("Ghost Avalanche") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Ghost Avalanche"), True)`)
}})
is_valid_trick("Snowstorm Shadow") should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Snowstorm Shadow"), False)`)
}})
is_valid_trick("Solar Sky") should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Solar Sky"), False)`)
}})
def is_valid_trick(trick_name):
return trick_name
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