AP CS 5: Iteration

Premium Lesson

This is a premium course. To view and assign premium course, you must upgrade your account

Upgrade Now

Learn to use repeat structures to make your code more efficient

Course Items

While Loops

While loops are a type of programming structure that allows us to instruct the computer to repeatedly perform a command a set number of times.

Functional While Conditions

While loops are not always used to repeat an action a set number of times, rather it's better to think of them as having the ability to repeat an action until a certain condition is met.

String Algorithms 1

Of the material covered so far, Strings are the best resource we have for implementing iteration challenges. Here we'll take a moment to understand some String manipulation features.

For Loops

For loops are a shorthand for a while loop with an iterator

String Algorithms 2

Write a function that takes a string and capitalizes every other character.

Reverse

Write a function that uses a while loop to reverse a string.

Replace

Write a function to replace each instance of a letter in a string with a different letter

Contains

Write a function that checks if a given string contains a given substring.

Nested for loops

We can nest loops to repeat a set of repeated actions a certain number of times

Nested for loops challenge

Write a program to produce a checkerboard

AP CS 5: Iteration Info

Track

AP Computer Science

Account

MVCode

Rank

Hacker

Created By

jamie

AP CS 5: Iteration Prereqs