Python Development: Working with If Statements, Loops, & Comprehensions

Python    |    Beginner
  • 13 videos | 1h 45m 18s
  • Includes Assessment
  • Earns a Badge
Rating 4.7 of 215 users Rating 4.7 of 215 users (215)
A handy procedure in Python for controlling the execution order of program statements is to implement branching operations using conditional statements, such as 'if' and 'else'. In this course, you'll learn how to use statements, loops, and comprehensions. First, you'll implement the conditional if statement. Then you'll use the else and elif statements. Moving on, you'll use Python's looping constructs, including the for-loop to iterate over elements in complex data types as well as over lists, tuples, and dictionaries. You'll use the while-loop and the break, continue, and pass keywords to further control loop execution. Finally, you'll implement list comprehension in Python, an elegant and efficient way of generating lists using 'for loops.' When you're finished with this course, you'll be able to write conditional statements in your code and perform looping and branching operations using for and while loops.

WHAT YOU WILL LEARN

  • Discover the key concepts covered in this course
    Implement branching code blocks using if statements
    Implement branching using else blocks and ternary if expressions
    Implement branching using elif blocks
    Iterate over sequences using for loops
    Iterate over dictionaries using for loops
    Use nested for loops for multiple looping operations
  • Perform looping operations using while loops
    Control loop iteration using break, continue, and pass
    Generate lists using list comprehension
    Generate lists using if conditions within list comprehension
    Implement generator and dictionary comprehension
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m 37s
    In this video, you’ll learn about your instructor and the course. This course will cover branching operations. You’ll learn how they can be implemented in Python using conditional statements. You’ll learn to implement the conditional if statement which allows you to evaluate conditions and execute the code in the if block only if a condition is true. Next, you’ll learn to add on the else and the elseif constructs and move on to looping constructs. FREE ACCESS
  • 9m 48s
    In this video, you’ll watch a demo. You’ll follow onscreen directions to identify an if block, learning more about if statements in Python. You’ll learn how delimiting is carried out using indentation in Python. You’ll evaluate conditions and follow along with various experiments. FREE ACCESS
  • Locked
    3.  Using Ternary If Statements in Python
    6m 29s
    In this video, you’ll watch another demo. This one will pick up where the previous demo left off. You’ll discover how to put together various building blocks in one combined if statement. You will also follow the demonstration to run code. FREE ACCESS
  • Locked
    4.  Using Elif Blocks for Multiple Python Branches
    6m 54s
    In this video, you’ll watch another demo. This one will pick up where the previous demo left off. You’ll discover another Python specific construct, the explicit if, elif, else construct. You’ll follow the directions onscreen, looking at strings of code. FREE ACCESS
  • Locked
    5.  Iterating over Sequences Using for Loops in Python
    9m 54s
    In this video, you’ll watch another demo. This one will pick up where the previous demo left off. You’ll discover another Python specific construct, the Python ForLoop. You’ll learn that most programming languages have ForLoops, which are powerful constructs for repeated iterative execution of code. You’ll follow onscreen directions to look at, and work with, a Python ForLoop. FREE ACCESS
  • Locked
    6.  Using for Loops to Iterate over Python Dictionaries
    9m 28s
    In this video, you’ll watch another demo. This one will pick up where the previous demo left off. In this one, you will continue building ForLoops over fairly complex but common types of data structures. You’ll take a look at a list of dictionaries, and learn more about dictionaries in general. You’ll discover that the onscreen dictionaries have a particular format, with the same keys. You will then iterate over the contents of the dictionary. FREE ACCESS
  • Locked
    7.  Creating Nested for Loops in Python
    11m 27s
    In this video, you’ll watch another demo. This one will pick up where the previous demo left off. In this one, you will continue exploring ForLoops, specifically looking at nested ForLoops. You will view a list of lists onscreen, as well as two sublists. You’ll follow the onscreen directions to iterate over all of the elements in the loop variable of the outer loop. You’ll print out this loop variable. FREE ACCESS
  • Locked
    8.  Working with While Loops in Python
    8m 41s
    In this video, you’ll watch another demo. This one will pick up where the previous demo left off. In this demo, you’ll move on to while loops. These are less popular than for loops. You’ll start with a simple while loop. You’ll follow while a variable number is initialized and set to 100. You will learn the result is an infinite loop. You’ll run this code and see how an infinite loop manifests in Python. FREE ACCESS
  • Locked
    9.  Using Break, Continue, and Pass in Python
    11m 11s
    In this video, you’ll watch another demo. This one will pick up where the previous demo left off. In this demo, you’ll learn and use three Python keywords, Break, Continue and Pass. You will discover Break and Continue have similar semantics in Python. Pass is a keyword that signifies a no-op. It does nothing, and you will learn its sole purpose is to tell someone that a particular block of code does nothing. FREE ACCESS
  • Locked
    10.  Creating Python Lists Using List Comprehension
    9m 30s
    In this video, you’ll watch another demo. This one will pick up where the previous demo left off. In this demo, you’ll learn about list comprehension. You’ll discover list comprehension is an elegant and concise way Python creates a list given the contents of another list. You’ll learn Python has a set comprehension to create sets. This demo will show you that Python allows you to get a lot done with minimal code. FREE ACCESS
  • Locked
    11.  Using Python If Statements Within List Comprehension
    9m 21s
    In this video, you’ll watch another demo. This one will pick up where the previous demo left off. In this demo, you will build on the basic syntax of list comprehension and add in a conditional expression. Onscreen, you’ll view a list comprehension. You will follow directions to create two lists. FREE ACCESS
  • Locked
    12.  Implementing Generator and Dictionary Comprehension
    7m 6s
    In this video, you’ll watch another demo. This one will pick up where the previous demo left off. In this demo, you’ll move on to generator comprehensions. You’ll see an example and then learn more about what generator comprehensions are. You’ll learn that generator objects are stateful. This means if you create another list from the same generator the return value will be an empty list. FREE ACCESS
  • Locked
    13.  Course Summary
    2m 53s
    In this video, you’ll summarize what you’ve learned in the course. You’ve learned to work with Conditionals, Loops, and Comprehensions. You discovered if statements that contain a condition as well as an If block. You then moved to the use of else blocks which are associated with if statements and executed if the condition evaluates to false. Then, you learned about the elif block, a Python-specific construct that allows multiple conditions to be chained together. 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.6 of 436 users Rating 4.6 of 436 users (436)
Rating 5.0 of 1 users Rating 5.0 of 1 users (1)

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.6 of 293 users Rating 4.6 of 293 users (293)
Rating 4.4 of 621 users Rating 4.4 of 621 users (621)
Rating 4.6 of 2165 users Rating 4.6 of 2165 users (2165)