Python Code Learning Day01

Source: Internet
Author: User

This is a time to learn some of the basics of Python paste what you learned today to come back and see how stupid you were.

1 #!/usr/bin/env python2 #Coding:utf83 4Print_num =05Count =06  whileCount < 100:7     ifCount = =Print_num:8         Print "there you got the number:", Count9Choice = Raw_input ("does want to continue to the loop? (y|n)")Ten         ifChoice = ='N': One              Break A         Else: -              whilePrint_num <=Count: -Print_num = input ("which loop do I want it to is printed out?") the                 ifPrint_num <=Count: -                     PrintU"It's over! baby!" -     Else: -         Print 'Loop:', Count +Count +=1 - Else: +     Print "Loopmax:", Count

The function of the above code

1 first determine if count and print_num are equal

2 If the equality is consulted whether you want to continue this cycle if you do not exit

3 Otherwise when print_num is less than or equal to count, consult with you which loop you want to print to, such as 30 to determine if this 30 is less than count if the hint is over.

4 if not, always print the loop: ... Know that until 30 will ask you to continue to print the other, if you enter a number greater than 30 will always print to know more than the count this time the last output Loopmax is how much

Results guided View

There you got the Number:0do do want to continue to the loop? (y|n) Ywhich loop Do you want it-be printed out?10loop:1loop:2loop:3loop:4loop:5loop:6loop:7loop:8loop:9there y Ou got the number:10do you want-continue to the loop? (y|n) Ywhich loop do you want it to be printed out?2 is over! baby! Which loop do I want it to is printed out?

If the output is greater than 100

Which loop do you want it-be printed out?101loop:11...loop:95loop:96loop:97loop:98loop:99loopmax:100

  

Python Code Learning Day01

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.