- くだすれPython(超初心者用) その33©2ch.net
235 :デフォルトの名無しさん[sage]:2017/04/20(木) 22:14:26.31 ID:ty4/Zu4t - 超初心者です失礼します
参考書パラパラ読んだところで何か作ってみようと持てる知識で書いてみました。 import random print("じゃんけん") te = input("手を入力>>[グー:0,チョキ:1,パー:2]") teban = ["グー", "チョキ", "パー"] aite = random.randint(0,2) print("ポン!") print("あなた:" + teban[int(te)] + " あいて:" + teban[aite] + "\n" ) te = int(te) if te < aite: if te * aite == 0: print("あなたの負け・・・") else: print("あなたの勝ち!") elif te > aite: if te * aite == 0: print("あなたの勝ち!") else: print("あなたの負け・・・") else: print("あーいこー") ======= isdigitとか色々加えなきゃいけない箇所は多々あると思うんですが if文のところがセンス無さすぎると痛感してます こういうセンスってどうすれば磨けるんですかね?
|