#Stone Scissors ClothImportRandomImporttimewin_list= [("Stone","Scissors"),("cloth","Stone"),("Scissors","cloth")]kind_list=['Stone','Scissors','cloth']Print("================ Welcome to man machine stone scissors cloth war, by Uncle Yang ===================") whileTrue:Print("Please wait for the robot to sign ...") Time.sleep (1) Print('...') Time.sleep (1) Robot=Random.choice (kind_list)Print("the robot has finished the card! ") People=STR (Input ("please input stone/scissors/cloth:"). Strip ()) Time.sleep (1) Print("Please wait for the system to determine ~ ~") Time.sleep (1) ifPeopleinchkind_list:Print("you have entered:", people) Time.sleep (1) Print("the robot inputs are:", Robot)ifPeople = =Robot:Print("Draw") elif(People,robot)inchwin_list:Print("you've won! ~!! ~ Game Over") Break Else: Print("you lose-defeat the robot to quit ^.^, the game continues") Else: Print("your input is not valid! Start again! ")
Scissors stone cloth small exercise learning programming is not only learning grammar, learning computational thinking, programming ideas is the focus.
Python actual combat = = = Stone Scissors cloth, simple model