Python

ยทpython
https://www.acmicpc.net/problem/2563 2563๋ฒˆ: ์ƒ‰์ข…์ด ๊ฐ€๋กœ, ์„ธ๋กœ์˜ ํฌ๊ธฐ๊ฐ€ ๊ฐ๊ฐ 100์ธ ์ •์‚ฌ๊ฐํ˜• ๋ชจ์–‘์˜ ํฐ์ƒ‰ ๋„ํ™”์ง€๊ฐ€ ์žˆ๋‹ค. ์ด ๋„ํ™”์ง€ ์œ„์— ๊ฐ€๋กœ, ์„ธ๋กœ์˜ ํฌ๊ธฐ๊ฐ€ ๊ฐ๊ฐ 10์ธ ์ •์‚ฌ๊ฐํ˜• ๋ชจ์–‘์˜ ๊ฒ€์€์ƒ‰ ์ƒ‰์ข…์ด๋ฅผ ์ƒ‰์ข…์ด์˜ ๋ณ€๊ณผ ๋„ํ™”์ง€์˜ ๋ณ€์ด ํ‰ํ–‰ํ•˜๋„๋ก www.acmicpc.net ์ฝ”๋“œ paper_list = [[0 for i in range(100)] for j in range(100)] times = int(input()) for _ in range(times): x, y = map(int, input().split()) for row in range(x, x+10): for col in range(y, y+10): paper_list[row][col] = 1 result ..
ยทpython
https://www.acmicpc.net/problem/10789 10789๋ฒˆ: ๊ฐ€์ƒ ํ‚ค๋ณด๋“œ ์ž…๋ ฅ ์ž…๋ ฅ์˜ ์ฒซ ๋ฒˆ์งธ ์ค„(ํ–‰)์—๋Š” ๋‘ ๊ฐœ์˜ ์ •์ˆ˜ r๊ณผ c (1 ≤ r, c ≤ 50)๊ฐ€ ํฌํ•จ๋˜์–ด ๊ฐ€์ƒ ํ‚ค๋ณด๋“œ ๊ฒฉ์ž์˜ ํ–‰๊ณผ ์—ด ์ˆ˜๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ๊ฐ€์ƒ ํ‚ค๋ณด๋“œ๋Š” ๋‹ค์Œ r ํ–‰์— ํ‘œ์‹œ๋˜๋ฉฐ ๊ฐ ํ–‰์—๋Š” c ๋ฌธ์ž๊ฐ€ ๋“ค์–ด ์žˆ์Šต๋‹ˆ๋‹ค. www.acmicpc.net ์ฝ”๋“œ my_list = [] for _ in range(5): my_list.append(list(input())) for row in range(15): for col in range(5): try: print(my_list[col][row], end="") except: continue ์„ค๋ช… 1. my_list์— ์ž…๋ ฅ๊ฐ’์„ ํ•œ์ค„ ์”ฉ list๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ์ €์žฅํ•œ๋‹ค. (2..
ยทpython
๋ฌธ์ œ for๋ฌธ ๋‚ด์—์„œ queires ๋‚ด์˜ index๋“ค์„ ๋ฐ˜๋ณต์ ์œผ๋กœ my_string์— ์ ์šฉ์‹œํ‚ค๋ฉด์„œ, ์ ์šฉ๋œ ๋‚ด์šฉ์„ ๋‹ค์‹œ my_string์— ์ €์žฅํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ํ•˜๋ฉด ๋  ๊ฒƒ ๊ฐ™๋‹ค. ์ฝ”๋“œ ๋ฐ ์„ค๋ช… def solution(my_string, queries): result = my_string for index in queries: front_string = result[:index[0]] mid_string = result[index[0]: index[1] + 1] back_string = result[index[1] + 1:len(result)] result = front_string + mid_string[::-1] + back_string return result for๋ฌธ ์†์˜ string slicing ..
ยทpython
python์˜ tkinter ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•ด์„œ ๋‹จ์œ„ ๋ณ€ํ™˜๊ธฐ๋ฅผ ๋งŒ๋“ค์–ด ๋ณด์ž. ์•„์ง tkinter ๋ชจ๋“ˆ์„ ์ฒ˜์Œ ๊ณต๋ถ€ํ•˜๋Š” ์ค‘์ด๊ธฐ ๋•Œ๋ฌธ์—, ๊ฐ„๋‹จํ•˜๊ฒŒ ๊ตฌํ˜„ํ•ด๋ณด์•˜๋‹ค. 1. miles to km, km to miles 2๊ฐ€์ง€ ์˜ต์…˜ ๊ตฌํ˜„ 2. ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅผ ์‹œ ๊ณ„์‚ฐ์ด ์™„๋ฃŒ๋˜์–ด ์™„๋ฃŒ ๊ฐ’์ด ์ถœ๋ ฅ ์ฝ”๋“œ from tkinter import * window = Tk() FONT = ("Arial", 20) from_unit = "miles" to_unit = "km" window.title("Unit Converter") window.minsize(width="250", height="100") window.config(padx=50, pady=25) # Label from_label = Label(text=f"{from_unit..
Chan Lee
'Python' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก