[lang-ref] ( ternary_conditional_operator_nested ) ( python )

@pytest.mark.parametrize(
    'v, expected',
    [
        (30, 'F'),
        (45, 'C'),
        (60, 'B'),
        (80, 'A'),
        (95, 'S'),
    ],
)
def test_ternary_conditional_operator_nested(v, expected):
    rank = 'F' if v < 40 \
      else 'C' if v < 50 \
      else 'B' if v < 75 \
      else 'A' if v < 90 \
      else 'S'

    assert rank == expected