boris@boris-All-Series:~/PYTHON/SWITCH$ cat switchCase10.py
def number_to_string(agrument):
match agrument:
case 0:
return "zero"
case 1:
return "one"
case 2:
return "two"
case default:
return "something"
if __name__ == "__main__":
agrument = 1
print(number_to_string(agrument))
agrument = 2
print(number_to_string(agrument))
boris@boris-All-Series:~/PYTHON/SWITCH$ python3.10 switchCase10.py | tee logsw.txt
one
two
boris@boris-All-Series:~/PYTHON/SWITCH$ cat logsw.txt
one
two
No comments:
Post a Comment