Conditional Statements & Loops: Advanced Operations Using for Loops in Python

Python    |    Beginner
  • 9 videos | 1h 5m 17s
  • Includes Assessment
  • Earns a Badge
Rating 4.6 of 291 users Rating 4.6 of 291 users (291)
Explore how iterating over elements using for loops can be controlled using the break and continue statements in Python. Creating sequences from other sequences using comprehensions is also covered in this 9-video course. Key concepts covered here include how to terminate a for loop when a specific condition is met using the break statement; learning how the break statement affects the code in the else block of a for loop; and observing how to skip an iteration of a for loop when a specific condition is met using the continue statement. Next, learn how to use the continue statement along with the break statement within the same for loop; learn the fact that no action is performed under specific conditions by using the pass statement; and create a list out of the contents of another list using a comprehension. Finally, you will learn about conditions in list comprehensions in order to filter elements used in the source list and to define values in the newly created list.

WHAT YOU WILL LEARN

  • Discover the key concepts covered in this course
    Terminate a for loop when a specific condition is met using the break statement
    Recognize how the break statement affects the code in the else block of a for loop
    Skip an iteration of a for loop when a specific condition is met using the continue statement
    Use the continue statement along with the break statement within the same for loop
  • Convey the fact that no action is performed under specific conditions by using the pass statement
    Create a list out of the contents of another list using a comprehension
    Specify conditions in list comprehensions in order to filter elements used in the source list and to define the values in the newly created list
    Write for loops that make use of the break and continue statements to control flow and use comprehensions to generate a list

IN THIS COURSE

  • 2m 32s
  • 8m 33s
    In this video, learn how to end a for loop when a specific condition is met using the break statement. FREE ACCESS
  • Locked
    3.  The break Statement and the else block
    7m 46s
    Upon completion of this video, you will be able to recognize how the break statement affects the code in the else block of a for loop. FREE ACCESS
  • Locked
    4.  The continue Statement: Part 1
    8m 26s
    In this video, you will learn how to skip an iteration of a for loop when a specific condition is met using the continue statement. FREE ACCESS
  • Locked
    5.  The continue Statement: Part 2
    6m 18s
    In this video, you will use the continue statement along with the break statement within the same for loop. FREE ACCESS
  • Locked
    6.  The pass Statement
    8m 27s
    Learn how to use the pass statement to convey that no action is performed under specific conditions. FREE ACCESS
  • Locked
    7.  Introducing Comprehensions
    9m 7s
    In this video, find out how to create a list from the contents of another list using a comprehension. FREE ACCESS
  • Locked
    8.  Applying Conditions in Comprehensions
    9m
    Upon completion of this video, you will be able to specify conditions in list comprehensions in order to filter elements used in the source list and to define the values in the newly created list. FREE ACCESS
  • Locked
    9.  Exercise: Advanced Operations in for Loops
    5m 7s
    Find out how to write for loops that make use of the break and continue statements to control flow, and use comprehensions to generate a list. FREE ACCESS

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

YOU MIGHT ALSO LIKE

Rating 5.0 of 1 users Rating 5.0 of 1 users (1)
Rating 4.4 of 621 users Rating 4.4 of 621 users (621)

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.5 of 543 users Rating 4.5 of 543 users (543)
Rating 4.7 of 414 users Rating 4.7 of 414 users (414)
Rating 4.6 of 293 users Rating 4.6 of 293 users (293)