Control the Flow of Your Program (Exercise)
00:00 Next review exercise. Now we’re getting into control flow of a program. So we’re actually going to write a program that we need to save and then execute.
00:09
The task is to write a program that prompts the user to enter a word using the input()
function, and then compare the length of the word to the number five.
00:17 The program should display one of the following outputs, depending on the length of the user’s input. And then we’ve got your input is less than five characters long, it’s greater than five characters long, or it is five characters long.
00:28 You can already maybe get an idea of what you’re supposed to do. It’s using three different Boolean comparators to figure out how the length of the string input of a user compares to the number five.
00:39 Take a moment and think about this. Open up a little script file and try to write it out. And once you’re done with your solution, you can move on to the next lesson, where I will build out a solution that you can compare yours to.
Become a Member to join the conversation.