In [ ]:
favorite_number = -1
### BEGIN SOLUTION
### END SOLUTION
print("My favorite number is: " + favorite_number)
In [ ]:
assert favorite_number >= 0
In [ ]:
famous_person = ""
their_quote = ""
### BEGIN SOLUTION
### END SOLUTION
print("{}, at age {}, said:\n\n\"{}\"".format(famous_person, favorite_number, their_quote))
In [ ]:
assert len(famous_person) > 0
assert len(their_quote) > 0
You're working late on a homework assignment and have copied a few lines from a Wikipedia article. In your tired stupor, your copy/paste skills leave something to be desired. Rather than try to force your mouse hand to stop shaking, you figure it's easier to write a small Python program to strip out errant whitespace from your copying-pasting.
Reassign each of the three variables (keeping their names the same, and their respective content otherwise unaltered) so that the trailing whitespace on both ends is removed.
In [ ]:
line1 = 'Python supports multiple programming paradigms, including object-oriented, imperative\n'
line2 = ' and functional programming or procedural styles. It features a dynamic type\n'
line3 = ' system and automatic memory management and has a large and comprehensive standard library.\n '
### BEGIN SOLUTION
### END SOLUTION
In [ ]:
assert line1[-1] != '\n'
assert line2[0] != line2[1] != ' '
assert line2[-1] != '\n'
assert line3[0] != ' '
assert line3[-1] != '\n'
In [ ]:
line1 = ' 495.59863 \n'
line2 = '\t134 '
line3 = '\n\t -5.4 \t'
num1 = -1
num2 = -1
num3 = -1
### BEGIN SOLUTION
### END SOLUTION
In [ ]:
assert num1 > 495 and num1 < 496
assert num2 == 134
assert num3 > -6 and num3 < -5
In [ ]:
number = 3.14159265359
str_version = ""
### BEGIN SOLUTION
### END SOLUTION
In [ ]:
assert str_version == "1.7724538509055743"