亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

初學者搖滾,紙藝,剪刀游戲Python語法

初學者搖滾,紙藝,剪刀游戲Python語法

一只斗牛犬 2021-04-02 04:24:19
我創建了一個Rock Paper Scissors游戲。它詢問您是否要玩,接受您的輸入,將其與計算機的隨機輸入進行比較,為您提供結果,然后詢問您是否要再次玩。我不知道為什么它不起作用。請讓我知道如何解決它。謝謝你import randomimport sys#playdef play():  print('want to play?')if input()=='yes':  print("Pick R/P/S")  user = input()# RPSdef RPS():  x = random.choice( ['Rock', 'Paper', 'scissors'] )print(x)if x == 'Rock' and user == 'R':  print('Tie')elif x == 'Rock' and user == 'P':  print('You beat Comp')elif x == 'Rock' and user == 'S':  print('Beat you')#--------if x == 'Paper' and user == 'R':  print('Lost to comp')elif x == 'Paper' and user == 'P':  print('tie')elif x == 'Paper' and user == 'S':  print('you beat comp')#---------if x == 'scissors' and user == 'R':  print('Beat comp')elif x == 'scissors' and user == 'P':  print('lost comp')elif x == 'scissors' and user == 'S':  print('tie')#Play againdef playagain():  print('Want to play again')  play=input()if play=='yes':    RPS()else:    print("Thanks for playing")play()RPS()playagain()
查看完整描述

2 回答

  • 2 回答
  • 0 關注
  • 163 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號