Python Programming Tutorial – 11 – Continue

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

26 responses to “Python Programming Tutorial – 11 – Continue”

  1. bresler94 Avatar

    if the print(n) is right under continue it wont print anything,when moving it tab backward its good,and when another tag backward,it prints 19
    explanation?

  2. Timur Akhalaya Avatar

    10 dislikes for US beating Russian's!

  3. Ultra_Vex Avatar

    kind of a dumb name for this keyword. skip would have been better. Just saying.

  4. Burdurky Avatar

    I put "break" in instead of "continue" for fun and I got what I expected in the output, 1
    numbers_taken = {2, 6, 12, 34, 22, 13}
    for n in range(1, 100):
    if n in numbers_taken:
    break
    print (n)
    However, when I moved the print command back one indent I get 2. why?
    numbers_taken = {2, 6, 12, 34, 22, 13}
    for n in range(1, 100):
    if n in numbers_taken:
    break
    print (n)

  5. alexedeigba Avatar

    Nice work Bucky. If i will like to the numbers divisible by four, using the same example what will i do?
    print("Here are the numbers that are divisible by 4")
    for n in range(1, 21):
    if n%4 is 0:
    continue
    print(n)
    the outcome is a list of numbers not visible by 4.

  6. DhÅnush Reddy Avatar

    Any IDEA why this Program doesn't print n values:
    ———————————————————————————-
    JerseyNumbersTaken = [12, 17, 21, 25, 29]
    print("HERE ARE THE JERSEY NUMBERS STILL AVAILABLE TO TAKE. ")
    for n in range(1, 30):
    if n in JerseyNumbersTaken:
    continue
    print(n)
    ———————————
    output:

    HERE ARE THE JERSEY NUMBERS STILL AVAILABLE TO TAKE.

    Process finished with exit code 0
    ————————–

  7. stefanvb2008 Avatar

    wow i was wondering why i cant do homework, but the problem was in "="
    for x in range(1,101):
    if x % 4 = 0:
    print(x)
    This doesnt work.. but it works with
    if x % 4 IS 0:

    omg

  8. dipin budhrani Avatar

    for n in range(101):
    if n % 4 is 0:
    print(n)

    My first try homework, 2nd try edited removed 0 from it by range(1,101)

    found another method by Increment by 4 reducing 1 line of code but the problem is 0 also gets involved.

    for n in range(0,101,4):
    print(n)

  9. chao sui Avatar

    continue is go on the loop and ignore the rest, but break is jumping out

  10. Peter1213 Avatar

    for n in range(1,101):
    if n % 4 is 0:
    print(n)

  11. Ruan Jacobus van Breda Avatar

    Made the mistake of typing: if n is numbersTaken: instead of: if n in numbersTaken:

    It is useful to distinguish between the two different uses:

    for n in range(1,20):
    if n in numbersTaken[:]:
    continue
    print(n)

    print('n')

    for n in range(1,20):
    for p in range(0,len(numbersTaken)):
    if n is numbersTaken[p]:
    print(n)

  12. Otabek Juraev Avatar

    zoom in your screen or teach us how to get the font larger. It is kind of not seen clearly what you type out there

  13. Kuldeep Sharma Avatar

    great Tutorial bro…u are the best ILU Bucky

  14. Youjin Wang Avatar

    for x in range (101):
        if x%4 is 0:
           print (x, " can be divided by 4 exactly.")

  15. Anuj Lal Shrestha Avatar

    always give us some assignments like you did in the previous one

  16. zyx P Avatar

    what is difference between 'is' and 'in'??

  17. Aditya Raj Tiwari Avatar

    for n in range(101):
    if n%4 is 0:
    print("you are done it is ", n)
    break
    else:
    print("Go on")

  18. Sabih Khan Avatar

    This program 11 not working with me , help 🙁

  19. Muhammed Alanamu Avatar

    Please help me, i cant re-install pycharm. its saying "NO PYTHON INTERPRETER SELECTED" Please help me….

  20. Asymptote Avatar

    for i in range(0, 101):
    if i % 4 is not 0:
    continue
    print(i)

  21. Damien Bertrand Avatar

    numbersTaken = [2, 5, 15, 12, 19]

    print("Here are the remaining numbers:")

    for n in range(1, 20):
    if n in numbersTaken:
    continue
    print(n, sep='', end=', ')

  22. Xandar Cyber Avatar

    i had to wath this tut 5 times to clik the trick behind the continue thing….

  23. Mukesh Giri Avatar

    when i am running the same code it is showing all the number

  24. Albert Mars Avatar

    i dont understand the in part when typing for n in range……

  25. The Python Inventor Avatar

    Awesome dude thxx a lot

Leave a Reply

Your email address will not be published. Required fields are marked *