CP104 Lecture 20: Cp104 lesson 20
hayjayshay and 38575 others unlocked
2
CP104 Full Course Notes
Verified Note
2 documents
Document Summary
Infinite loops repeat and do not stop until the program is externally interrupted. Causes: 1) the programmer forgets to change the loop condition variable(s) o 2) the programmer changes the loop condition variable(s) incorrectly o 3) the condition is incorrectly written, 4) the loop lacks an actual test condition. Python has a boolean type with two values: o true, false. Ex. grade = int(input( enter final grade: )) Passed = grade >= 50 #doing this is probably clearer than doing if grade >= 50: If passes == true: print( you passed the course! ) condition controlled loopevent driven. While not_found == true: guess = int(input( guess a number: )) o if guess == secret_number: # ask a user to guess a secret number. While guess != secret_number: print( try again! , guess = int(input( guess a number: ) - print( you win! ) Input validation is the process of validating the input to an application before using it.