Python/Python 어렵게 배우기
Python 어렵게 배우기 - Exercise 11: Asking Questions
purepleya
2013. 11. 28. 21:00
원문 : http://learnpythonthehardway.org/book/ex11.html
키보드로 입력을 받아보자 (ex11.py)
print "How old are you?", age = raw_input() print "How tall are you?", height = raw_input() print "How much do you weigh?", weight = raw_input() print "So, you're %r old, %r tall and %r heavy." % (age, height, weight)
print 문 뒤에 콤마(",")를 사용하는 이유는 입력받는 문자가 print 된 문자열 바로 뒤에 표시 되도록 하기 위함이다. (간단히 테스트 해볼것)
결과
알 수 있는 내용...
1. 키보드로 입력을 받을때는 raw_input() 함수를 사용한다.
반응형