CSCA08H3 Lecture Notes - Equals Sign, Boiling Point

72 views3 pages
19 Oct 2011
School
Course

Document Summary

A true/false value is called a boolean type, named after george boole, a philosopher and logician of the early 19th century. In python we denote the boolean type by bool. The bool type in python has only two values: true and false. There are many different operators in python that evaluate to true or false (note the capital letters). For each of the following expressions that use conditional operators, write down the result that they evaluate to: 7 == 7 # why not just one equals sign?\ x = 7 y = 7. 0 x == y. False is stored internally as 0, and true as 1. Even though true is 1, when checking boolean condition, python treats any non-zero number as true. Examples to try out: if 9. 2423: print "yay" if 0: print. What does this do? num = 6 if num == 10 or 20 or 30: print "yay" else: print "no way"

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

Related Questions