Python de emparejamiento de patrones estructurales
# Structural pattern matching allows you to write switch/case statements
# in Python. You need to have Python 3.10 to use this feature.
x = 10
match x:
case 10:
print('x = 10') # if x is 10, this will print 10
case 20:
print('x = 20') # if x is 20, this will print 20
case _:
# The underscore allows you to write a default case if none of the
# conditions above are true.
print(f'x = {x}')
Old Pizza