데이터 입/출력 본문
** 데이터 입/출력 방식 : input() -> typing -> memory 적재 -> print() -> 출력
** input() 함수를 이용한 데이터 입력
input() 함수를 통해서 아무거나 입력하세요 : "input 내용" 을 받아서 print(변수)로 출력하였음
하단 이미지 input("아무거나 입력하세요 :" ) 처럼 ""안에 안내문구 삽입 가능
** input 함수로 입력한 데이터는 항상 문자(열) 자료형이다
hello, 10, 3.14, True -> input() -> print(type()) 시에 모두 str
** input 함수로 입력한 데이터를 형변환 하면, 정상적으로 출력된다
hello -> str(input()) -> type() -> str
10-> int(input()) -> type() -> int
3.14 -> float(input()) -> type() -> float
True -> bool(input()) -> type() -> bool
** print() 함수를 이용한 데이터 출력
** print() 함수를 이용한 기본적인 데이터 출력
userName = "박김박"
print(userName)
** 콤마(,)를 이용한 데이터 연속 출력
print('User name : " , userName)
** 자동 개행을 막는 옵션 print(a,b,end='')
'BF 2024 > 자료구조' 카테고리의 다른 글
format() (0) | 2022.01.26 |
---|---|
특수문자 (0) | 2022.01.26 |
자료형 변환(type casting) (0) | 2022.01.26 |
자료형(Data type) 이란? (0) | 2022.01.26 |
변수 작명법 (0) | 2022.01.26 |
Comments