CP104 Lecture 20: Cp104 lesson 20

17 views2 pages
School
Course
hayjayshay and 38575 others unlocked
CP104 Full Course Notes
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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents