jyanken.py
import random
dic = {"a": "グー", "b": "チョキ", "c": "パー"}
print("じゃんけん")
print("a=グー b=チョキ c=パー")
user_hand = input(">>> ")
user_choice = dic[user_hand]
choice_list = ["a", "b", "c"]
pc = dic[random.choice(choice_list)]
draw = 'あいこ'
win = 'あなたの勝ち'
lose = 'あなたの負け'
if user_choice == pc:
judge = draw
else:
if user_choice == "グー":
if pc == "チョキ":
judge = win
else:
judge = lose
elif user_choice == "チョキ":
if pc == "パー":
judge = win
else:
judge = lose
else:
if pc == "グー":
judge = win
else:
judge = lose
print("あなた:" + user_choice)
print("コンピュータ:" + pc)
print("結果:" + judge)