생활코딩

Coding Everybody

코스 전체목록

닫기

입력과 출력

사용자의 입력을 애플리케이션으로 가져오기

Python

in_str = input("입력해주세요.\n")
print(in_str.upper()+" World!")

ideone.com

Ruby

puts("입력해주세요")
in_str = gets.chomp()
puts(in_str.upcase() + " World!")

 ideone.com

 

로그인 애플리케이션에 입력 기능 추가하기

Python

in_str = input("아이디를 입력해주세요.\n")
real_egoing = "11"
real_k8805 = "ab"
if real_egoing == in_str:
  print("Hello!, egoing")
elif real_k8805 == in_str:
  print("Hello!, k8805")
else:
  print("Who are you?")

ideone.com

Ruby

puts("아이디를 입력해주세요")
input = gets.chomp()
real_egoing = "11"
real_k8805 = "ab"
if real_egoing == input
  puts("Hello!, egoing")
elsif real_k8805 == input
  puts("Hello!, k8805")
else
  puts("Who are you?")
end

ideone.com

참고

github

댓글

댓글 본문
버전 관리
egoing
현재 버전
선택 버전
graphittie 자세히 보기