Python & Ruby — 입력과 출력 (생활 코딩)

Nanyoung Kim
2 min readApr 30, 2020

강의 출처 — 생활 코딩

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

<Python>

in_str = input("입력해주세요.\n")print(in_str.upper()+" World!")  //upper() 는 대문자 처리

<Ruby>

puts("입력해주세요")in_str = gets.chomp()   //gets.chomp()는 사용자가 입력한 정보를 가져옴.puts(in_str.upcase() + " World!")

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

<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?")

<Ruby>

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

--

--