fork(5) download
  1. import random
  2.  
  3. win_cnt = 0
  4.  
  5. print("----------------------------------------------------")
  6. name = str(input("이름을 입력하세요!\n"))
  7. print("----------------------------------------------------")
  8.  
  9. while True:
  10. player_state = int(input("쌀은 1번! 보리는 2번!\n"))
  11. tagger_state = random.randrange(1, 3)
  12.  
  13. if player_state == 1:
  14.  
  15. if tagger_state == 1:
  16. print("상대방: 잡았다!")
  17. print(name + ": 망했다!")
  18. print("잡혔습니다. 게임이 종료됩니다. 총 " + str(win_cnt) + "번 승리했네요.")
  19. print("----------------------------------------------------")
  20. break
  21.  
  22. else:
  23. print("상대방: 날쌔군!")
  24. print("상대방이 잡지 못했습니다!")
  25. win_cnt += 1
  26. print("현재까지 " + str(win_cnt) + "번 승리했습니다.")
  27. print("----------------------------------------------------")
  28.  
  29. else:
  30. print(name + ": 진정해. 보리였어.")
  31. print("----------------------------------------------------")
Runtime error #stdin #stdout #stderr 0.12s 23232KB
stdin
Standard input is empty
stdout
----------------------------------------------------
이름을 입력하세요!
stderr
Traceback (most recent call last):
  File "./prog.py", line 6, in <module>
EOFError: EOF when reading a line