Learn Python starting from 0 and learn the first program after 5 hours

Source: Internet
Author: User

1 ImportRandom2 Import Time3Input"--century gambling king tournament, the official start--\n Note: (This format to take five innings three wins system) \ n hit ' Enter ' key \ n instantly join the king of the game ...")4i = 15z =06y =07x =08  whileI <= 5:9     Print('The game is officially started and the countdown to section%d. Reday'%i)Ten      forKinchRange (3,0,-1):      One         Print('\b\b\b'*38, K) ATime.sleep (1)                   -A = Random.randint (1,6) -b = Random.randint (1,6) thec = Random.randint (1,6) -E = Random.randint (1,6) -f = Random.randint (1,6) -g = Random.randint (1,6) +D = A + B +C -H = e + f +g +     Print('GO!!! Officially open the card!!! ') A     Print('the computer's dice {0},{1},{2}, total {3} points! '. Format (a,b,c,d)) at     Print('your dice is {0},{1},{2}, total {3} points! '. Format (e,f,g,h)) -     ifD >h: -X+=1 -         Print('you are less than the opponent in the%d innings "you lose, don't lose heart, try again!"'%i) -         ifI < 5: -Input'tap ' Enter ' to open the next inning game') in         Else: -Input'completed all matches and hit ' Enter ' to calculate the result of the match')             to     elifD = =h: +Y+=1 -         Print('your number%d points equals the opponent "Ah Yo, accidentally, draw, this is fate Ah!"'%i) the         ifI < 5: *Input'tap ' Enter ' to open the next inning game') $         Else:Panax NotoginsengInput'completed all matches and hit ' Enter ' to calculate the result of the match')             -     elifD <h: theZ+=1 +         Print('your number%d points is greater than the opponent "you win, gambling God possessed Ah, fat brother give me sign a name!"'%i) A         ifI < 5: theInput'tap ' Enter ' to open the next inning game') +         Else: -Input'completed all matches and hit ' Enter ' to calculate the result of the match')             $I+=1 $ Else: -     if5-y<2*Z: -         Print('start calculating the results of the game ... \ n You won the%d game in 5 innings.'%z) the         Print('Congratulations, you won the King of Gambling tournament, embark on the pinnacle of life, win white rich beauty! ') -     Else:Wuyi         Print('start calculating the results of the game ... \ n you lost the%d game in the 5 innings.'%x) the         Print('I'm sorry, ya lost the king of gambling tournament, go home and practice 20 years, come again! ') -Input'tap ' Enter ' to exit the game') Wu     

Learning Python is too painful, completely look at the feeling of the heavenly book, good abstraction, or first directly according to their own ideas to do things, not the words to check from the dictionary, feel more suitable for themselves, this program is learned three hours later, see the use of random numbers, their own thinking of the game, writing very stupid, according to their own ideas, Chi three hours, finally Chi can run, haha, good sense of accomplishment ah

Learn Python starting from 0 and learn the first program after 5 hours

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.