Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

3.0 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
697a49e9860d24853adef67e Challenge 193: 2026 Winter Games Day 14: Ski Mountaineering 29 challenge-193

--description--

Given the snow depth and slope of a mountain, determine if there's an avalanche risk.

  • The snow depth values are "Shallow", "Moderate", or "Deep".
  • Slope values are "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"

--hints--

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")`)
}})

--seed--

--seed-contents--

def avalanche_risk(snow_depth, slope):

    return snow_depth

--solutions--

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]