Код: Выделить всё
python -u "/Users/Riccardo/Desktop/Coding/Python/Programmi Python/prove.py"
Riccardo@ipicchiop Coding % python -u "/Users/Riccardo/Desktop/Coding/Python/Programmi Python/prove.py"
File "/Users/Riccardo/Desktop/Coding/Python/Programmi Python/prove.py", line 2
match status:
^
SyntaxError: invalid syntax
Riccardo@ipicchiop Coding % python3 --version
Python 3.12.4
Riccardo@ipicchiop Coding %
Код: Выделить всё
def http_error(status):
match status:
case 200:
return "OK"
case 400:
return "Bad request."
case 404:
return "Page not found"
case 500:
return "Internal Server error"
case _:
return "Something went wrong"
print(http_error(400))
Подробнее здесь: https://stackoverflow.com/questions/786 ... ion-3-12-4