Python actual combat = = = Stone Scissors cloth, simple model

Source: Internet
Author: User

#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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.