ipl-logo

Pt1420 Unit 1 Language Analysis

309 Words2 Pages
x = 10 while x != 0: print x x = x - 1 print " we 've counted x down, and it now equals", x print "And the loop has now ended." Boolean Expressions So, above, where we talked through w to write a “while” loop, you see where we put “condition that the loop continues”? What goes in here is what we call a Bool- ean expression. All that means is a question that can be answered with a TRUE or a FALSE re- sponse. Let’s say that you wanted to put that your age is the same as that of the person sat next to you. Here is what you would type: My age == the age of the person sat next to me The response would be TRUE. If your age was lower than the person sat oppo- site, you would type: My age < the age of the person sat opposite me The
Open Document