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