๋ชฉ๋ก์ ์ฒด ๊ธ (433)
whatisthis?
์ฃผ์ด์ง ์ฝ๋๋ก ๋ถ๋์ฐ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค. ์ถ๋ ฅ ์์. ์ด 3๋์ ๋งค๋ฌผ์ด ์์ต๋๋ค. ๊ฐ๋จ ์ํํธ ๋งค๋งค 10์ต 2010๋ ๋งํฌ ์คํผ์คํ ์ ์ธ 5์ต 2007๋ ์กํ ๋น๋ผ ์์ธ 500/50 2000๋ class House: # ๋งค๋ฌผ ์ด๊ธฐํ def __init__(self, location, house_type, deal_type, price, year): pass # ๋งค๋ฌผ ์ ๋ณด ํ์ def show_detail(self): pass ___ ๋ด๊ฐ ์์ฑํ ์ฝ๋ ___ class House: def __init__(self, location, house_type, deal_type, price, year): self.location = location self.house_type = house_type self...
Phython. ํ์ด์ฌ ์ฝ๋ฉ ๊ธฐ์ดํธ-08(ไธ) ๋น์ ์ ํ์ฌ์์๋ ๋งค์ฃผ 1ํ ๋ณด๊ณ ์๋ฅผ ์์ฑํด์ผํ๋ค. ๋ณด๊ณ ์๋ ํญ์ ์๋์ ๊ฐ์ ํํ๋ก ์ถ๋ ฅ๋์ด์ผํ๋ค. - X ์ฃผ์ฐจ ์ฃผ๊ฐ ๋ณด๊ณ - ๋ถ์ : ์ด๋ฆ : ์ ๋ฌด ์์ฝ : 1์ฃผ์ฐจ๋ถํฐ 50์ฃผ์ฐจ๊น์ง์ ๋ณด๊ณ ์ ํ์ผ์ mywebproject.tistory.com 7. ๋ฉ์๋ ์ค๋ฒ๋ผ์ด๋ฉ ์์ํด๋์ค์์ ์ ์ํ ๋ฉ์๋๋ฅผ ์ฌ์ฉํ๊ณ ์ถ์ ๋, ๋ฉ์๋ ์ค๋ฒ๋ผ์ด๋ฉ์ ์ฌ์ฉ. 1. Unit ํด๋์ค์ move ํจ์๋ฅผ ์ถ๊ฐ๋ก ์ ์ํ๋ค. ์ง์ ์ ๋์ด ์ด๋ํ๋ ๊ฒฝ์ฐ์ move์ด๋ค. class Unit: def __init__(self, name, hp, speed): self.name = name self.hp = hp self.speed = speed def move(self, location):..
๋น์ ์ ํ์ฌ์์๋ ๋งค์ฃผ 1ํ ๋ณด๊ณ ์๋ฅผ ์์ฑํด์ผํ๋ค. ๋ณด๊ณ ์๋ ํญ์ ์๋์ ๊ฐ์ ํํ๋ก ์ถ๋ ฅ๋์ด์ผํ๋ค. - X ์ฃผ์ฐจ ์ฃผ๊ฐ ๋ณด๊ณ - ๋ถ์ : ์ด๋ฆ : ์ ๋ฌด ์์ฝ : 1์ฃผ์ฐจ๋ถํฐ 50์ฃผ์ฐจ๊น์ง์ ๋ณด๊ณ ์ ํ์ผ์ ๋ง๋๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค. ์กฐ๊ฑด : ํ์ผ๋ช ์ 1์ฃผ์ฐจ.txt , 2์ฃผ์ฐจ.txt, ... ์ ๊ฐ์ด ๋ง๋ ๋ค. ๋ด๊ฐ ์์ฑํ ์ฝ๋ for week in range(1,51): with open("{0}์ฃผ์ฐจ.txt".format(week), "w", encoding="utf8") as report_file: report_file.write("- {0} ์ฃผ์ฐจ ์ฃผ๊ฐ ๋ณด๊ณ - \n๋ถ์ :\n์ด๋ฆ : \n์ ๋ฌด์์ฝ : \n".format(week)) ๋๋ with๋ฌธ์ ์ด์ฉํ์๋ค. ์ด ๋์ for week in range(1..
ํ์ค ์ฒด์ค์ ๊ตฌํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค *๊ณต์ ๋จ์ : ํค(m) * ํค(m) * 22 ์ฌ์ : ํค(m) * ํค (m) * 21 1. ํ์ค์ฒด์ค์ ๋ณ๋์ ํจ์ ๋ด์์ ๊ณ์ฐ - ํจ์๋ช : std_weight / ์ ๋ฌ๊ฐ : height, gender 2. ํ์ค ์ฒด์ค์ ์์์ ๋์จฐ์๋ฆฌ๊น์ง ํ๊ธฐ ํค 175cm ๋จ์์ ํ์ค ์ฒด์ค์ 67.38kg ์ ๋๋ค. ์์์ ๋์งธ์๋ฆฌ๊น์ง ๋ฐ์ฌ๋ฆผํ๋ ๋ฐฉ๋ฒ 1. round ์ด์ฉ print(round(3.3678, 2) 3.37 2. format ์ด์ฉ { : .2f}".format(3.3678) 3.37 ์ ๊ณฑ ๊ตฌํ๋ ๋ฐฉ๋ฒ 1. x ** y 2. pow(a, b) : a์ b์ ๊ณฑ 3. math ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์์ math.pow(x, y) ** ๋ด๊ฐ ์์ฑํ ์ฝ๋ def std_weight(..
๋น์ ์ ์นด์นด์ค ์๋น์ค๋ฅผ ์ด์ฉํ๋ ํ์๊ธฐ์ฌ์ด๋ค. 50๋ช ์ ์น๊ฐ๊ณผ ๋งค์นญ ๊ธฐํ๊ฐ ์์๋, ์ด ํ์น ์น๊ฐ ์๋ฅผ ๊ตฌํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค. 1. ์น๊ฐ๋ณ ์ดํ ์์ ์๊ฐ์ 5๋ถ ~ 50๋ถ ์ฌ์ด ๋์๋ก ์ ํด์ง๋ค. 2. ๋น์ ์ ์์์๊ฐ 5๋ถ ~ 15๋ถ ์ฌ์ด ์น๊ฐ๋ง ๋งค์นญํด์ผ ํ๋ค. [O] 1๋ฒ์งธ ์๋ (์์์๊ฐ : 15๋ถ) [ ] 2๋ฒ์จฐ ์๋ (์์์๊ฐ : 50๋ถ) [O] 3๋ฒ์งธ ์๋ (์์์๊ฐ : 5๋ถ) ... [ ] 50๋ฒ์งธ ์๋ (์์์๊ฐ : 16๋ถ) ์ด ํ์น ์น๊ฐ : 2 ๋ถ ๋ด๊ฐ ์์ฑํ ์ฝ๋. # 50๋ช ์ ์๋ ์ค ํ์น ์น๊ฐ ์ ๊ตฌํ๋ ํ๋ก๊ทธ๋จ from random import * count = 0; for matching in range(1, 51): time = randint(5, 51) if(5 = mo..
์กฐ๊ฑด๋ฌธ(if) / ๋ฐ๋ณต๋ฌธ (for, while) / continue์ break ๋น์ ์ ํ๊ต์์๋ ํ์ด์ฌ ์ฝ๋ฉ ๋ํ๋ฅผ ์ฃผ์ตํ๋ค. ๋๊ธ ์ด๋ฒคํธ๋ฅผ ์งํํ๊ธฐ๋ก ํ๋๋ฐ, ๋๊ธ ์์ฑ์์ค์์ 1๋ช ์ ์นํจ, 3๋ช ์ ์ปคํผ ์ฟ ํฐ์ ๋ฐ๊ฒ ๋๋ค. ์ถ์ฒจ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค. ์กฐ๊ฑด1) ํธ์์ ๋๊ธ์ 20๋ช ์ด ์์ฑํ๊ณ , ์์ด๋๋ 1~20 ์ด๋ผ ๊ฐ์ ์กฐ๊ฑด2) ๋๊ธ ๋ด์ฉ๊ณผ ๊ด๋ จ ์์ด ๋ฌด์์๋ก ์ถ์ฒจ. ์ค๋ณต์ ๋ถ๊ฐ ์กฐ๊ฑด3) random ๋ชจ๋์ shuffle๊ณผ sample์ ์ด์ฉ shuffle(๋ณ์๋ช ) = ์์ ๋๋ค์ผ๋ก ์์ด์ฃผ๋ ํจ์ sample(๋ณ์๋ช , ๊ฐฏ์) = ๊ฐฏ์๋งํผ ๋๋ค์ผ๋ก ๋ฝ๋ ํจ์ (1:51:04) ์ถ๊ฐ๋ก ๊ฐ์์์ ๋์ค์ง ์์์ง๋ง, ์ ์ง 1๋ถํฐ 20๊น์ง๋ฅผ ์ง์ ์ปด๋ง๋ก ๋์ดํ๋ ๊ฒ์ ๋นํจ์จ์ ์ด๋ผ ์๊ฐ๋์๋ค. ๋ฐ๋ผ์ ๋ ๊ตฌ๊ธ๋ง..
์์ ์ค flex - CSS: Cascading Style Sheets | MDN flex CSS ์์ฑ์ ํ๋์ ํ๋ ์ค ์์ดํ ์ด ์์ ์ ์ปจํ ์ด๋๊ฐ ์ฐจ์งํ๋ ๊ณต๊ฐ์ ๋ง์ถ๊ธฐ ์ํด ํฌ๊ธฐ๋ฅผ ํค์ฐ๊ฑฐ๋ ์ค์ด๋ ๋ฐฉ๋ฒ์ ์ค์ ํ๋ ์์ฑ์ ๋๋ค. developer.mozilla.org flex flex ์์ฑ์ ํ๋์ ํ๋ ์ค ์์ดํ ์ด ์์ ์ ์ปจํ ์ด๋๊ฐ ์ฐจ์งํ๋ ๊ณต๊ฐ์ ๋ง์ถ๊ธฐ ์ํด ํฌ๊ธฐ๋ฅผ ํค์ฐ๊ฑฐ๋ ์ค์ด๋ ๋ฐฉ๋ฒ์ ์ค์ ํ๋ ์์ฑ์ ๋๋ค. ๋๋ถ๋ถ์ ๊ฒฝ์ฐ, flex์ ๊ฐ์๋ auto, initial, none์ด๋ ๋จ์ ์๋ ์์ ์๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค. flex: 1; flex: 1 30px; flex: 1 1 100px; auto, initial, none initial ์์ดํ ํฌ๊ธฐ๊ฐ ๊ฐ๊ฐ์ width์ height ์์ฑ์ ๋ฐ๋ผ ์ ํด์ง๋..
float - CSS: Cascading Style Sheets | MDN CSS ์์ฑ(property) float ์ ํ ์์(element)๊ฐ ๋ณดํต ํ๋ฆ(normal flow)์ผ๋ก๋ถํฐ ๋น ์ ธ ํ ์คํธ ๋ฐ ์ธ๋ผ์ธ(inline) ์์๊ฐ ๊ทธ ์ฃผ์๋ฅผ ๊ฐ์ธ๋ ์๊ธฐ ์ปจํ ์ด๋์ ์ข์ฐ์ธก์ ๋ฐ๋ผ ๋ฐฐ์น๋์ด์ผ ํจ์ ์ง์ ํฉ๋๋ค. developer.mozilla.org float CSS ์์ฑ(property) float ์ ํ ์์(element)๊ฐ ๋ณดํต ํ๋ฆ(normal flow)์ผ๋ก๋ถํฐ ๋น ์ ธ ํ ์คํธ ๋ฐ ์ธ๋ผ์ธ(inline) ์์๊ฐ ๊ทธ ์ฃผ์๋ฅผ ๊ฐ์ธ๋ ์๊ธฐ ์ปจํ ์ด๋์ ์ข์ฐ์ธก์ ๋ฐ๋ผ ๋ฐฐ์น๋์ด์ผ ํจ์ ์ง์ ํฉ๋๋ค. float: none; (์ด๊ธฐ๊ฐ) float: left; float: right; ๋ถ๋(floating) ์์ = fl..