Skip to content
KnowledgeCity

Loop Structures

Learn the best uses for different loop structures
Preview the first lesson free — get full access to all 4 lessons.
Course: On-Demand
Beginner Provider John Crabtree  4 Lessons ·  16m  in Arabic, German, English, Spanish, French, Portuguese, Chinese 

Course Description

Loops are presented in these lessons, beginning with the while loop. The use of counting with while loops is demonstrated followed by a discussion of the range object and its use in for loops. The two different loop types are then compared and contrasted with a discussion of which style to use and why.

LEARNING OBJECTIVES:

What You'll Learn

  • Understand the purpose and best uses for a while loop
  • Recognize that a while loop is indefinite and depends on end-user input
  • Use counting techniques with while loops
  • Apply the range() object within for loops
  • Recognize that a for loop is definite and best used when the number of iterations is known
  • Compare and contrast while loops and for loops to choose the right style

Key Takeaways

  • A while loop is indefinite and depends on the end user inputting information.
  • A for loop is definite and should be used when you know how many times your program needs to loop.
  • The range object is introduced and used together with for loops.
  • The course compares and contrasts the two loop types and discusses which style to use and why.

Frequently Asked Questions

What does this course cover?

It presents loop structures, beginning with the while loop, demonstrates counting with while loops, discusses the range object and its use in for loops, and compares while and for loops to explain which style to use and why.

What is the difference between a while loop and a for loop in this course?

The course explains that a while loop is indefinite and depends on the end user inputting information, while a for loop is definite and should be used if you know how many times your program needs to loop.

What lessons are included?

The lessons are Indefinite Loops, Counting with While Loops, For Loops and Range(), and While vs. For Loops.

What skills does this course build?

It covers Code Structure, Control Loops, Data Structures, Loop Unrolling, Nested Loops, and Programming Concepts.