Python Development: Working with If Statements, Loops, & Comprehensions
Python
| Beginner
- 13 videos | 1h 45m 18s
- Includes Assessment
- Earns a Badge
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 courseImplement branching code blocks using if statementsImplement branching using else blocks and ternary if expressionsImplement branching using elif blocksIterate over sequences using for loopsIterate over dictionaries using for loopsUse nested for loops for multiple looping operations
-
Perform looping operations using while loopsControl loop iteration using break, continue, and passGenerate lists using list comprehensionGenerate lists using if conditions within list comprehensionImplement generator and dictionary comprehensionSummarize the key concepts covered in this course
IN THIS COURSE
-
2m 37sIn 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 48sIn 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
-
6m 29sIn 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
-
6m 54sIn 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
-
9m 54sIn 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
-
9m 28sIn 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
-
11m 27sIn 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
-
8m 41sIn 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
-
11m 11sIn 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
-
9m 30sIn 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
-
9m 21sIn 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
-
7m 6sIn 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
-
2m 53sIn 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.