코드
# 문제: 10진수를 입력받아 16진수(hex)로 출력
a= input()
n=int(a)
print('%x'%n)
실행 결과
해설
10진수 형태로 입력받고 %x로 출력하면 16진수(hexadecimal) 소문자로 출력된다.
%o로 출력하면 8진수(octal) 문자열로 출력된다.
'Programming Study > Python' 카테고리의 다른 글
[CodeUp-python] 기초 100제 #6029 (0) | 2023.01.27 |
---|---|
[CodeUp-python] 기초 100제 #6028 (0) | 2023.01.27 |
[CodeUp-python] 기초 100제 #6026 (0) | 2023.01.26 |
[CodeUp-python] 기초 100제 #6025 (0) | 2023.01.26 |
[CodeUp-python] 기초 100제 #6024 (0) | 2023.01.26 |