fork download
  1. #!/usr/bin/env python3
  2.  
  3. # 上の一文がシェバング/シバン
  4.  
  5. import sys
  6.  
  7. # 関数定義
  8. def foo(name):
  9. match name:
  10. case 'ゆゆにゃ。':
  11. return 'おー、輝かしい未来が見えるぞよ。'
  12. case _:
  13. return '汝の未来は・・・おっと待った、いま何時だ!\n私は行かねばならない。失敬する!'
  14.  
  15. # 実行部はこのように書く
  16. if __name__ == '__main__':
  17. print(foo(sys.argv[1]))
  18.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Traceback (most recent call last):
  File "/usr/lib/python3.9/py_compile.py", line 144, in compile
    code = loader.source_to_code(source_bytes, dfile or file,
  File "<frozen importlib._bootstrap_external>", line 918, in source_to_code
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "./prog.py", line 9
    match name:
          ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.9/py_compile.py", line 150, in compile
    raise py_exc
py_compile.PyCompileError:   File "./prog.py", line 9
    match name:
          ^
SyntaxError: invalid syntax

stdout
Standard output is empty