curriculum/challenges/english/blocks/daily-coding-challenges-python/697a49e9860d24853adef67e.md
Given the snow depth and slope of a mountain, determine if there's an avalanche risk.
"Shallow", "Moderate", or "Deep"."Gentle", "Steep", or "Very Steep".Return "Safe" or "Risky" based on this table:
"Shallow" | "Moderate" | "Deep" | |
|---|---|---|---|
"Gentle" | "Safe" | "Safe" | "Safe" |
"Steep" | "Safe" | "Risky" | "Risky" |
"Very Steep" | "Safe" | "Risky" | "Risky" |
avalanche_risk("Shallow", "Gentle") should return "Safe".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Shallow", "Gentle"), "Safe")`)
}})
avalanche_risk("Shallow", "Steep") should return "Safe".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Shallow", "Steep"), "Safe")`)
}})
avalanche_risk("Shallow", "Very Steep") should return "Safe".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Shallow", "Very Steep"), "Safe")`)
}})
avalanche_risk("Moderate", "Gentle") should return "Safe".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Moderate", "Gentle"), "Safe")`)
}})
avalanche_risk("Moderate", "Steep") should return "Risky".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Moderate", "Steep"), "Risky")`)
}})
avalanche_risk("Moderate", "Very Steep") should return "Risky".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Moderate", "Very Steep"), "Risky")`)
}})
avalanche_risk("Deep", "Gentle") should return "Safe".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Deep", "Gentle"), "Safe")`)
}})
avalanche_risk("Deep", "Steep") should return "Risky".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Deep", "Steep"), "Risky")`)
}})
avalanche_risk("Deep", "Very Steep") should return "Risky".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Deep", "Very Steep"), "Risky")`)
}})
def avalanche_risk(snow_depth, slope):
return snow_depth
def avalanche_risk(snow_depth, slope):
risk_table = {
"Gentle": {
"Shallow": "Safe",
"Moderate": "Safe",
"Deep": "Safe",
},
"Steep": {
"Shallow": "Safe",
"Moderate": "Risky",
"Deep": "Risky",
},
"Very Steep": {
"Shallow": "Safe",
"Moderate": "Risky",
"Deep": "Risky",
},
}
return risk_table[slope][snow_depth]