반응형
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding:utf-8 -*- | |
#test by Xd | |
num_data = 100 #num_data에 100을 대입 | |
bin_data = 0b10 #bin_data에 0b10을 대입 | |
oct_data = 0o10 #oct_data에 0o10을 대입 | |
hex_data = 0x10 #hex_data에 0x10을 대입 | |
nummm_data = 1234567890 #nummm_data에 1234567890을 대입 | |
print(num_data) #num_data 출력 | |
print(bin_data) #bin_data 출력 | |
print(oct_data) #oct_data 출력 | |
print(hex_data) #hex_data 출력 | |
print(nummm_data) #nummm_data 출력 |

정수형 자료는 여러가지가 있다.
컴퓨터에선 2진법을 사용하기 때문에 8진법이나 16진법도 편리하게 사용된다.
사진은 처음 수(100)는 정수이고
그 아래로
2진법
8진법
16진법이다.
마지막 수는 정수를 길게 쓴 것이다.
8비트 = 8자리 2진수로 표현 가능
1바이트 = 두 자리 16진수로 표현 가능
따라서 컴퓨터의 대부분의 데이터는 16진수로 표현이 가능하다.
반응형
'homework-jueon > 0x01-200제' 카테고리의 다른 글
18. 복소수형 자료 (0) | 2020.01.01 |
---|---|
17. 실수형 자료 (0) | 2020.01.01 |
15. None 개념 (0) | 2019.12.31 |
14. while(while~ continue~ break) (0) | 2019.12.31 |
13. for문 개념(for~ else) (0) | 2019.12.31 |