- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
CONTINUE in Python FOR Loops - Python Tutorial for Beginners
🎓 Welcome back to Digital Academy, the Complete Python Development Tutorial for Beginners, which will help you Learn Python from A to Z!
🖥️ CONTINUE in Python FOR Loops
In each example you have seen so far, the entire body of the FOR Loop is executed, on each iteration. It is all very well, but quite limited, Right? Fortunately for you, Python provides two keywords that will terminate a loop iteration, prematurely: BREAK and CONTINUE in Python.
Great! Let's dig a little deeper, and suppose this time you do not want to exit the loop with BREAK, but just skip the current iteration, and execute the rest of the iterations anyway - with the next items.
The Python CONTINUE statement on the other hand, will immediately terminate the current loop iteration. The execution jumps to the top of the loop and re-evaluate the expression, to determine whether the loop will execute again, with the next iteration, or if it will terminate and proceed to the first statement following the loop - like it would, with "break" reserved keyword you have seen before.
for var in sequence:
statement_1
statement_2
if condition:
continue
...
statement_3
following_statement
Let's have a look at the same example you have seen, in the break statement. But, instead of break, you will now use the continue statement. Continue is also a control statement, but the only difference is that it will only skip the current iteration in the loop, continues with the next iteration, then executes the rest of the iterations anyway, until it reaches the last item of the sequence.
colours = ['red', 'green', 'blue', 'yellow']
for colour in colours:
if colour == 'blue':
continue
print(colour)
In the above example, as soon as the loop encounters the item 'blue', it will enter the if statement block, where the continue statement will skip the current item in the loop, then continues to the next iteration, with the item yellow. This, will result in printing out 'red', 'green' and 'yellow' - since blue has been skipped over.
Let's play this video, stick around and watch until the end of this video! 👍🏻
- Digital Academy™ 🎓
***
☞ WATCH NEXT:
○ Data Types in Python - https://youtu.be/cweUByxBWiU
○ Operators in Python - https://youtu.be/-wDaVLkKOiU
○ IF Statements in Python - https://youtu.be/CC5seZ6OBJ4
○ FOR Loops in Python - https://youtu.be/JgH-D5DSTho
📖 Blog: http://digital.academy.free.fr/blog
📖 [FULL Course] HOW TO Learn Python? Python Tutorial for Beginners: https://youtu.be/9hvnSZPMtuw
📖 [PLAYLIST] Complete Python Development Course for Beginners: http://digital.academy.free.fr/playlist/python-development-for-beginners
🧑🎓 [COURSE] http://digital.academy.free.fr/courses
📘 [BOOK] Python for Absolute Beginners: https://amzn.to/3NvyOWV
🛒 Shopping and Discounts: http://digital.academy.free.fr/store
💌 Weekly Newsletter for Developers: https://www.getrevue.co/profile/digital_academy
#Python #Tutorial #Beginners #Shorts
***
♡ Thanks for watching and supporting ♡
Please Subscribe. Hit the notification bell.
Like, Comment and Share.
***
♡ FOLLOW US ♡
✧ http://digital.academy.free.fr/
✧ https://twitter.com/DigitalAcademyy
✧ https://www.facebook.com/digitalacademyfr
✧ https://www.instagram.com/digital_academy_fr/
✧ https://www.youtube.com/c/DigitalAcademyOnline
♡ SUPPORT US ♡
✧ http://digital.academy.free.fr/join
✧ http://digital.academy.free.fr/store
✧ http://digital.academy.free.fr/donate
✧ http://digital.academy.free.fr/subscribe
✧ https://www.patreon.com/digital_academy
✧ https://www.buymeacoffee.com/digital_academy
***
Видео CONTINUE in Python FOR Loops - Python Tutorial for Beginners канала Digital Academy
🖥️ CONTINUE in Python FOR Loops
In each example you have seen so far, the entire body of the FOR Loop is executed, on each iteration. It is all very well, but quite limited, Right? Fortunately for you, Python provides two keywords that will terminate a loop iteration, prematurely: BREAK and CONTINUE in Python.
Great! Let's dig a little deeper, and suppose this time you do not want to exit the loop with BREAK, but just skip the current iteration, and execute the rest of the iterations anyway - with the next items.
The Python CONTINUE statement on the other hand, will immediately terminate the current loop iteration. The execution jumps to the top of the loop and re-evaluate the expression, to determine whether the loop will execute again, with the next iteration, or if it will terminate and proceed to the first statement following the loop - like it would, with "break" reserved keyword you have seen before.
for var in sequence:
statement_1
statement_2
if condition:
continue
...
statement_3
following_statement
Let's have a look at the same example you have seen, in the break statement. But, instead of break, you will now use the continue statement. Continue is also a control statement, but the only difference is that it will only skip the current iteration in the loop, continues with the next iteration, then executes the rest of the iterations anyway, until it reaches the last item of the sequence.
colours = ['red', 'green', 'blue', 'yellow']
for colour in colours:
if colour == 'blue':
continue
print(colour)
In the above example, as soon as the loop encounters the item 'blue', it will enter the if statement block, where the continue statement will skip the current item in the loop, then continues to the next iteration, with the item yellow. This, will result in printing out 'red', 'green' and 'yellow' - since blue has been skipped over.
Let's play this video, stick around and watch until the end of this video! 👍🏻
- Digital Academy™ 🎓
***
☞ WATCH NEXT:
○ Data Types in Python - https://youtu.be/cweUByxBWiU
○ Operators in Python - https://youtu.be/-wDaVLkKOiU
○ IF Statements in Python - https://youtu.be/CC5seZ6OBJ4
○ FOR Loops in Python - https://youtu.be/JgH-D5DSTho
📖 Blog: http://digital.academy.free.fr/blog
📖 [FULL Course] HOW TO Learn Python? Python Tutorial for Beginners: https://youtu.be/9hvnSZPMtuw
📖 [PLAYLIST] Complete Python Development Course for Beginners: http://digital.academy.free.fr/playlist/python-development-for-beginners
🧑🎓 [COURSE] http://digital.academy.free.fr/courses
📘 [BOOK] Python for Absolute Beginners: https://amzn.to/3NvyOWV
🛒 Shopping and Discounts: http://digital.academy.free.fr/store
💌 Weekly Newsletter for Developers: https://www.getrevue.co/profile/digital_academy
#Python #Tutorial #Beginners #Shorts
***
♡ Thanks for watching and supporting ♡
Please Subscribe. Hit the notification bell.
Like, Comment and Share.
***
♡ FOLLOW US ♡
✧ http://digital.academy.free.fr/
✧ https://twitter.com/DigitalAcademyy
✧ https://www.facebook.com/digitalacademyfr
✧ https://www.instagram.com/digital_academy_fr/
✧ https://www.youtube.com/c/DigitalAcademyOnline
♡ SUPPORT US ♡
✧ http://digital.academy.free.fr/join
✧ http://digital.academy.free.fr/store
✧ http://digital.academy.free.fr/donate
✧ http://digital.academy.free.fr/subscribe
✧ https://www.patreon.com/digital_academy
✧ https://www.buymeacoffee.com/digital_academy
***
Видео CONTINUE in Python FOR Loops - Python Tutorial for Beginners канала Digital Academy
continue python for loop continue python loop python continue loop python break continue python for loops for loops in python python continue statement for loop python digital academy python for beginners python continue for loop break and continue in python python tutorial for beginners python tutorial python loops loops in python learn python python continue python break and continue python loop python for loop python basics for loop in python
Комментарии отсутствуют
Информация о видео
28 февраля 2021 г. 13:00:03
00:02:18
Другие видео канала





















