# 입력 함수 input()
# 컴퓨터야 이 값을 " 입력받아줘 "
# 쓰는 방법: 변수 = input()
name = input()
print(name)
print("\n-----문제 1-----")

say = input()
print('앵무새가 말한다 ' + say)

# 변수 age에 나이를 입력받아요.
age = input()

# 변수 age를 출력해봐요.
print(age)

print("\n-----문제 2-----")
# 변수 name에 이름을 입력받아요.
name = input()

# "안녕하세요, OOO님!" 이라고 출력하세요.
print('"안녕하세요, ' + name + '님!"')
print('이','루','오')


# type() 함수
# " 자료형 "을 알아내는 함수
# 쓰는 방법: type(데이터)
print(type(13))   # 숫자형(정수)->int
print(type(3.14))   # 숫자형(실수)->float
print(type('루오'))   # 문자열->str
print(type([0,1,2,3]))   # 리스트->list


# 자료형 변환하는 법
# 기본 형태: 형 변환 함수(데이터)
print(int('123'))  # 문자열 123을 정수로 변환
print(str(123))    # 숫자형 123을 문자열로 변환
print(list('123')) # 문자열 123을 리스트로 변환
print(float(123))  # 정수인 123을 실수로 변환


print("\n----- 문제 3 -----")
# 본인의 나이, 이름의 타입을 각각 출력해보세요.
print(type(13))
print(type('이루오'))


print("\n----- 문제 4 -----")
# input()으로 데이터를 입력받으면, 항상 문자열(str) 형태로 저장돼요.
# 아래 코드의 주석을 제거한 뒤 실행해보세요.
# 어떤 자료형이 나오는지 확인해보세요.

data = input("아무거나 입력해보세요: ")
print("입력한 값의 자료형은?", type(data))


Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: