Python/Python 어렵게 배우기
Python 어렵게 배우기 - Exercise 14: Prompting and Passing
purepleya
2013. 12. 2. 20:30
원문 : http://learnpythonthehardway.org/book/ex14.html
앞에서 공부한 raw_input, argv를 다시 사용 해 보자 (ex14.py)
from sys import argv script, user_name = argv prompt = '> ' print "Hi %s, I'm the %s script." % (user_name, script) print "I'd like to ask you a few questions." print "Do you like me %s?" % user_name likes = raw_input(prompt) print "Where do you live %s?" % user_name lives = raw_input(prompt) print "What kind of computer do you have?" computer = raw_input(prompt) print """ Alright, so you said %r about liking me. You live in %r. Not sure where that is. And you have a %r computer. Nice. """ % (likes, lives, computer)
결과
알 수 있는 내용...
앞에서 다 공부한듯...
반응형