Python Magician Solo digital game

Source: Internet
Author: User

Objective


Learn the basics of Python first, everything is difficult at the beginning! Let's learn to develop!


Direct on Dry Goods


#coding: UTF8

S=input (' Please enter a year: ')

S=int (s)

Year=false

If s% ==0 and% 400 ==0:

Year=true

elif S% 100! =0 and S% 4 ==0:

If year:

Pirnt (' Leap Year ')

Else

Print (' Common year ')


650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/06/c40e936395440e7502fd3da49faaa008.png-wh_500x0-wm_3 -wmp_4-s_543217342.png "title=" image 1.png "alt=" C40e936395440e7502fd3da49faaa008.png-wh_ "/>


Python arithmetic functions


#coding: UTF8

Lsl=input (' Input score ')

If lsl==100:

Print (' Good you are the best ')

Elif LSL > 90:

Print (' What the hell! ‘)

Elif LSL >80:

Print (' Don't listen carefully in class! ‘)

Elif LSL >70:

Print (' It's time to study! ‘)

Elif LSL >60:

Print (' Will you get a pass? ‘)


650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/06/576e11fca0c7e5bd1a18d2fe84e03c32.png-wh_500x0-wm_3 -wmp_4-s_271858589.png "title=" image 1.png "alt=" 576e11fca0c7e5bd1a18d2fe84e03c32.png-wh_ "/>


Summarize! Accumulate a bit!


Python guessing numbers game


#coding: UTF8

Import Random,time

Secret=random Randint (1,99)

Guess=0

Tries=0

print ' together to play a guessing game of numbers! ‘

print ' to guess the number from 1 to 100, I'll give you 10 chances '

While guess! = Secret and tries <10:

Guess = input ("What do you think it is")

If guess < secret:

print ' is too small '

Elif guess > secret;

print ' is too big '

Tries = tries + 1

if guess = = secret:

print ' haha you guessed it '

Time.sleep (2)

Else

Print "You're 250, this is wrong!" The correct answer is: ", Secret,"! "

Time.sleep (2)


650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/06/508d612d6566520701e08050abc6084b.png-wh_500x0-wm_3 -wmp_4-s_403871910.png "title=" image 1.png "alt=" 508d612d6566520701e08050abc6084b.png-wh_ "/>


650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/06/b95f14c367c5c581a8a1f72f2dbeb8bf.png-wh_500x0-wm_3 -wmp_4-s_2942648079.png "title=" image 2.png "alt=" B95f14c367c5c581a8a1f72f2dbeb8bf.png-wh_ "/>


650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/06/9084994939d97ccce6ad290dc8cd24f1.png-wh_500x0-wm_3 -wmp_4-s_2649242859.png "title=" image 3.png "alt=" 9084994939d97ccce6ad290dc8cd24f1.png-wh_ "/>

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/06/796afa52dca43c2f7cc62dd9f91e2611.png-wh_500x0-wm_3 -wmp_4-s_3595089069.png "title=" image 4.png "alt=" 796afa52dca43c2f7cc62dd9f91e2611.png-wh_ "/>

This article from "Li Shilong" blog, declined reprint!

Python wizard solo number game

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.