From 0acfdd8714886b5941da1170db2d85d9cc30c7e5 Mon Sep 17 00:00:00 2001 From: Joseph Pan Date: Thu, 9 Jan 2014 20:23:44 +0000 Subject: [PATCH] Exchange raw_input with input() or eval(input()). --- Python3/ex11.py | 3 +-- Python3/ex12.py | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Python3/ex11.py b/Python3/ex11.py index 0ca9479..c00e3cd 100755 --- a/Python3/ex11.py +++ b/Python3/ex11.py @@ -15,9 +15,8 @@ print("So, you're %r old, %r tall and %r heavy." % (age, height, weight)) print("Enter a integer: ", end=" ") -num = int(raw_input()) # won't work with int(raw_input)), with eval(input()) it would work +num = int(eval(input())) # won't work with int(raw_input)), with eval(input()) it would work print("The number you've input is: %d" % num) - print("Enter a name: ", end=" ") name = input() print("What's %s's age?" % name, end=" ") diff --git a/Python3/ex12.py b/Python3/ex12.py index d841598..7ff367f 100755 --- a/Python3/ex12.py +++ b/Python3/ex12.py @@ -1,9 +1,9 @@ #!/bin/python3 # ex12: Prompting People -# exchange raw_input with input() or eval(input()) -age = raw_input("How old are you?") -height = raw_input("How tall are you? ") -weight = raw_input("How much do you weigh? ") + +age = input("How old are you?") +height = input("How tall are you? ") +weight = input("How much do you weigh? ") print("So, you're %r old, %r tall and %r heavy." % (age, height, weight))