Please enable JavaScript to use CodeHS

Utah Computer Programming 1 and 2

Lesson 10.4 Strings and For Loops

Description

In this lesson, students will look at the use of for loops with strings. Since both string indices and for loops index at zero, the len value can be used to go through strings in a for loop. Indicies don’t need to be explicitly used. The syntax for character in my_string can be used to go through a for loop one character at a time.


Objective

Students will be able to:

  • iterate over characters in a string using for loops