본문 바로가기
프로그래밍/알고리즘

백준 11654 파이썬

by monicada 2022. 10. 27.
728x90

문제

 

11654번: 아스키 코드

알파벳 소문자, 대문자, 숫자 0-9중 하나가 주어졌을 때, 주어진 글자의 아스키 코드값을 출력하는 프로그램을 작성하시오.

www.acmicpc.net

 

문제 답변

print(ord(input()))

 

관련 설명 

아스키코드 반호나 함수는 'ord' 함수를 사용하면 된다 

 

Python ord()

Python ord() In this tutorial, we will learn about the Python ord() function with the help of examples. The ord() function returns an integer representing the Unicode character. Example character = 'P' # find unicode of P unicode_char = ord(character) prin

www.programiz.com

 

참고로, ord()의 반대는 chr()이다 

 

'프로그래밍 > 알고리즘' 카테고리의 다른 글

백준 2869 파이썬  (0) 2022.11.01
백준 1712 파이썬  (0) 2022.10.31
백준 4673 파이썬  (0) 2022.10.26
백준 8958 파이썬  (0) 2022.10.25
프로그래머스 알고리즘 - 03/25  (0) 2022.10.18

댓글