Chapter 2 Exercise Set 2: PCEP Practice¶
print() and its arguments¶
Modify the first
printstatement in this code:print("Python", "for", "Web") print("Developers")
using
sepandendkeyword arguments so that together they print:Python++for++Web**Developers
Ways to write numbers¶
Convert each of the following into digit only integers in base 10:
12_345_6810o120O_210x120X21
Convert the following into base 10 decimal numbers without exponents.
4e223e-3
Comparing True and False¶
Describe and explain the output of the following two statements:
print(True > False) print(True < False)
Quotes in strings¶
Write a single line
printstatement that produces the following output:"I'm" ""learning to"" ''program'' with """Python"""
Types of literals¶
What is the type of each of the following literals?
"Python""42"4242.False'False'
Operators, precedence, and left-sided and right-sided binding¶
How will the Python interpreter evaluate each of the following expressions?
>>> print((-3 / 6), (3 / 6), (3 // 6), (-3 // 6))>>> print((2 % -4), (2 % 4), (2 ** 3 ** 2))
Variables¶
What two things does every Python variable have?