๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿง CodingTest

[Python] CodeUp ๊ธฐ์ดˆ 100์ œ_ 6027, 6028, 6029, 6030, 6031

by ._.sori 2025. 5. 12.

 

#6027_ 10์ง„ ์ •์ˆ˜๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ 16์ง„์ˆ˜๋กœ ์ถœ๋ ฅํ•˜๊ธฐ1

์†Œ๋ฌธ์ž ํ˜•ํƒœ๋กœ ์ถœ๋ ฅ

์ž…๋ ฅ: 255
์ถœ๋ ฅ: ff
a = int(input())
print('%x'%a)
a = input()
b = int(a)
print('%x'%b)

 

 

 

#6028_ 10์ง„ ์ •์ˆ˜๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ 16์ง„์ˆ˜๋กœ ์ถœ๋ ฅํ•˜๊ธฐ2

๋Œ€๋ฌธ์ž ํ˜•ํƒœ๋กœ ์ถœ๋ ฅ

์ž…๋ ฅ: 255
์ถœ๋ ฅ: FF
a = int(input())
print('%X'%a)
a = input()
b = int(a)
print('%X'%b)

 

 

 

#6029_ 16์ง„ ์ •์ˆ˜๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ 8์ง„์ˆ˜๋กœ ์ถœ๋ ฅํ•˜๊ธฐ2

์ž…๋ ฅ: f
์ถœ๋ ฅ: 17
a = input()
print(f'{int(a,16):o}')
a = input()
b = int(a, 16)
print('%o'%b)
ํŒŒ์ด์ฌ์—์„œ ์ง„๋ฒ• ๊ฐ„ ๋ณ€ํ™˜์„ ํ•  ๋•Œ ์ค‘๊ฐ„์— 10์ง„์ˆ˜๋ฅผ ๊ฑฐ์ณ์•ผํ•œ๋‹ค.

 

 

 

#6030_ ์˜๋ฌธ์ž 1๊ฐœ๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ 10์ง„์ˆ˜๋กœ ๋ณ€ํ™˜ํ•˜๊ธฐ

์ž…๋ ฅ: A
์ถœ๋ ฅ: 65
a = ord(input())
print(a)
ord๋Š” ๋ฌธ์ž์˜ ์•„์Šคํ‚ค ์ฝ”๋“œ๊ฐ’ ํ˜น์€ ์œ ๋‹ˆ์ฝ”๋“œ๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์ˆซ์ž๋กœ ๋ณ€ํ™˜ํ•ด์ฃผ๋Š” ํ•จ์ˆ˜๋‹ค.
๊ทธ๋ž˜์„œ ๋ณ€ํ™˜๋˜์—ˆ๊ธฐ์— a๋งŒ ์ถœ๋ ฅํ•ด๋„ ์›ํ•˜๋Š” ๊ฐ’์ด ๋‚˜์˜จ๋‹ค.

 

 

 

#6031_ ์ •์ˆ˜ ์ž…๋ ฅ๋ฐ›์•„ ์œ ๋‹ˆ์ฝ”๋“œ ๋ฌธ์ž๋กœ ๋ณ€ํ™˜ํ•˜๊ธฐ

์ž…๋ ฅ: 65
์ถœ๋ ฅ: A
a = int(input())
print(chr(a))