Intro To Computing
Intro To Computing
Intro To Computing
ES102
Lecture 3
>>> 1.0 + 2
>>> 1.0 + 2.0
>>> 1 + “2”
>>> “1” + “2”
Comparisons
Comparisons
● Results of comparisons is a truth value, boolean
expression
– True or False
>>> x = 2
>>> x >= 2
True
>>> x <= 1
False
>>> 1.2 * 6.0 == 7.2
False
Math functions
● In order to use math functions, we have to use
the module
– in python, useful functions are stored in packages
known as modules
>>> import math
>>> a = math.log10(2)
>>> print a Notice the math.log10
0.301029995664 notation.
print “Lyrics of an alltime favorite”
print “Lyrics of an alltime favorite”
IndentationError: expected an indented block