Nested Loop Exam Questions &
Answers 2024/2025
While Loops - ANSWERSA loop that repeats as long as a conditional statement within them are True.
While Loop Example - ANSWERSpassword = None
while password != "myPassword1234":
password = input("enter the password: ")
if password != "myPassword1234":
print("Your password is incorrect.")
print("Correct password. Welcome.")
Infinite Loops - ANSWERSWhile Loops that use a Boolean statement that can never become false
Infinite Loop Examples - ANSWERSwhile True:
while 4>3:
while "hello" == "hello"
while 5 <= 5:
How to Exit an Infinite Loop - ANSWERSCtrl + C (Windows)
Nested Loop - ANSWERSWhen one loop is put inside another loop
What's the difference between a while loop and a for loop? - ANSWERSA for loop runs a set amount of
times, and a while loop will run as long as its conditions is True
Answers 2024/2025
While Loops - ANSWERSA loop that repeats as long as a conditional statement within them are True.
While Loop Example - ANSWERSpassword = None
while password != "myPassword1234":
password = input("enter the password: ")
if password != "myPassword1234":
print("Your password is incorrect.")
print("Correct password. Welcome.")
Infinite Loops - ANSWERSWhile Loops that use a Boolean statement that can never become false
Infinite Loop Examples - ANSWERSwhile True:
while 4>3:
while "hello" == "hello"
while 5 <= 5:
How to Exit an Infinite Loop - ANSWERSCtrl + C (Windows)
Nested Loop - ANSWERSWhen one loop is put inside another loop
What's the difference between a while loop and a for loop? - ANSWERSA for loop runs a set amount of
times, and a while loop will run as long as its conditions is True