I Haz Codes

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Menu
Condition controlled

Learn

Condition controlled loops will not run a predictable number of times and tend to be controlled by the user. However, the way we solve problems using them is VERY similar.

  1. Write the code to be repeated.
  2. Set up the start and end points.
  3. Write how we will get from the start to the end

Try

Bob, Sally, Zara, Yusuf and Simon want to a program which will pick randomly between them. It should pick one of them at random and then ask if they want to pick again.

They are happy that the same student could be picked twice.

Part of the code has been produced for you.

Challenge

Dave does not want anyone using his super cool program. He has decided to protect it with a password.

Write a program which will ask the user to enter a password. If the password is incorrect, then it should ask for the password again. If it is correct then the user should be allowed to continue.

Task to try

Challenge task

Comments are closed.

Information