Permalink
Browse files

Completed Ex. 8

Also completed the EC to the best of my ability.
I'm not sure why repr() prints strings with quotes.  If it
converts objects to str objects, and those string objects are being
printed, why not without the quotes?
  • Loading branch information...
1 parent c90661f commit fe6961e13846648e44e929b0e64ffffbd932d261 @franksort committed Mar 2, 2012
Showing with 18 additions and 0 deletions.
  1. +18 −0 ex8.py
View
18 ex8.py
@@ -0,0 +1,18 @@
+# Assigning a string to a variable.
+formatter = "%r %r %r %r"
+
+# Using formatter as a format string for the values...
+print formatter % (1, 2, 3, 4)
+print formatter % ("one", "two", "three", "four")
+print formatter % (True, False, False, True)
+print formatter % (formatter, formatter, formatter, formatter)
+print formatter % (
+ "I had this thing.",
+ "That you could type up right.",
+ "But it didn't sing.",
+ "So I said goodnight."
+)
+
+# I have no idea why %r or repr() prints strings with quotes around them
+# I know repr converts an object to str
+# saying fuck it right now. I'll learn about it later.

0 comments on commit fe6961e

Please sign in to comment.