Skip to content
Browse files

example 11 extra credit

  • Loading branch information...
1 parent aac5fb3 commit 41115f7c093d02b0b1240ae0aa415f7a3fddc2c2 @phlipper committed Apr 12, 2012
Showing with 23 additions and 0 deletions.
  1. +23 −0 ex11.py
View
23 ex11.py
@@ -7,3 +7,26 @@
print "So, you're %r old, %r tall and %r heavy." % (
age, height, weight)
+
+
+
+# Extra Credit
+
+# Go online and find out what Python's raw_input does.
+# ^^ http://docs.python.org/library/functions.html#raw_input
+
+# Can you find other ways to use it? Try some of the samples you find.
+echo = raw_input("[echo] -> ")
+print "ECHO: %s" % echo
+
+# Write another "form" like this to ask some other questions.
+print "Do you like this book so far? ",
+answer1 = raw_input("(yes/no) ")
+print "Are we having fun yet? ",
+answer2 = raw_input("(yes/no) ")
+print "You answered %r to liking this book and %r to having fun" % (
+ answer1, answer2)
+
+# Related to escape sequences, try to find out why the last line has '6\'2"'
+# with that \' sequence. See how the single-quote needs to be escaped because
+# otherwise it would end the string?

0 comments on commit 41115f7

Please sign in to comment.
Something went wrong with that request. Please try again.