๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ443

[์–ด์„œ์™€ ํŒŒ์ด์ฌ์€ ์ฒ˜์Œ์ด์ง€!_2019 Ver] 4์žฅ Lab ๋„์ „๋ฌธ์ œ ํ’€์ด # 4์žฅ Lab ๋„์ „๋ฌธ์ œ ํ’€์ด 157p_Lab ๋„์ „๋ฌธ์ œ) import turtle spi = turtle.Turtle() size = 16 for i in range(50): size = size + 3 spi.forward(size) spi.right(24) 158p_Lab ๋„์ „๋ฌธ์ œ) import turtle octagon = turtle.Turtle() sides = 8 side_length = 133 angle = 360.0 / sides for i in range(sides): octagon.forward(side_length) octagon.right(angle) 162p_Lab ๋„์ „๋ฌธ์ œ) import turtle import math # ์ขŒํ‘œ์ถ• ๊ทธ๋ฆฌ๊ธฐ line = turtle.Turtle() .. 2023. 2. 18.
[์–ด์„œ์™€ ํŒŒ์ด์ฌ์€ ์ฒ˜์Œ์ด์ง€!_2019 Ver] 3์žฅ Lab ๋„์ „๋ฌธ์ œ ํ’€์ด (2) # 3์žฅ Lab ๋„์ „๋ฌธ์ œ ํ’€์ด (2) 123p_Lab ๋„์ „๋ฌธ์ œ) user_list = ['๊ฐ€๋‚˜๋‹ค', '๋ผ๋งˆ๋ฐ”', '์‚ฌ์•„์ž'] pass_list = ['111', '222', '333'] name = input('์•„์ด๋””: ') if name in user_list: password = input('ํŒจ์Šค์›Œ๋“œ: ') if password in pass_list: print('ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค.') else: print('์ž˜๋ชป๋œ ํŒจ์Šค์›Œ๋“œ์ž…๋‹ˆ๋‹ค.') else: print('ํ™•์ธ๋˜์ง€ ์•Š์€ ์‚ฌ์šฉ์ž์ž…๋‹ˆ๋‹ค.') 124p_Lab ๋„์ „๋ฌธ์ œ) number = input('์ˆซ์ž๋ฅผ ์ž…๋ ฅํ•˜์‹œ์˜ค: ') han1 = ['์ผ', '์ด', '์‚ผ', '์‚ฌ', '์˜ค', '์œก', '์น ', 'ํŒ”', '๊ตฌ'] num = ['1', '2', '3', '4.. 2023. 2. 17.
[Python] print() ํ•จ์ˆ˜ ์‚ฌ์šฉ ์‹œ ๋นˆ์นธ ๋ฐ ๊ณต๋ฐฑ ์ œ์™ธํ•˜๊ณ  ์ถœ๋ ฅํ•˜๋Š” ๋ฐฉ๋ฒ• # print() ํ•จ์ˆ˜ ์‚ฌ์šฉ ์‹œ ๋นˆ์นธ ๋ฐ ๊ณต๋ฐฑ ์ œ์™ธํ•˜๊ณ  ์ถœ๋ ฅํ•˜๋Š” ๋ฐฉ๋ฒ• print() ํ•จ์ˆ˜๋Š” ํŒŒ์ด์ฌ ์–ธ์–ด์— ์˜ํ•ด ๊ธฐ๋ณธ์ ์œผ๋กœ ์ œ๊ณต๋˜๋Š” ํ•จ์ˆ˜๋กœ, ํ…์ŠคํŠธ๋ฅผ ํ™”๋ฉด์— ์ถœ๋ ฅํ•˜๋Š” ์ž‘์—…์„ ํ•œ๋‹ค. print() ํ•จ์ˆ˜๋Š” ์•„๋ž˜ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด 2๊ฐœ ์ด์ƒ์˜ ๊ฐ’์„ ์ธ์ˆ˜๋กœ ๋ฐ›์•„ ์ถœ๋ ฅํ•  ๋•Œ, ์ถœ๋ ฅ๊ฐ’๋“ค ์‚ฌ์ด์— ๋นˆ์นธ์„ ์ถ”๊ฐ€์ ์œผ๋กœ ์ถœ๋ ฅํ•œ๋‹ค. ์ด๋Š” print() ํ•จ์ˆ˜์˜ ๊ตฌ๋ถ„์ž๊ฐ€ '๊ณต๋ฐฑ'์œผ๋กœ ์ง€์ •๋˜์–ด์žˆ๊ธฐ ๋•Œ๋ฌธ์ธ๋ฐ, ํ•จ์ˆ˜์˜ ๊ตฌ๋ถ„์ž๋ฅผ ๋””ํดํŠธ๊ฐ’์ธ '๊ณต๋ฐฑ'์ด ์•„๋‹ˆ๋ผ null ๋กœ ์ง€์ •ํ•ด์ฃผ๋ฉด ๋นˆ์นธ์„ ์ œ์™ธํ•˜๊ณ  ์ถœ๋ ฅํ•  ์ˆ˜ ์žˆ๋‹ค. ๋งŒ์•ฝ ๋นˆ์นธ์„ ์ œ์™ธํ•˜๊ณ  ์ถœ๋ ฅํ•ด์•ผํ•  ๊ฒฝ์šฐ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด print() ํ•จ์ˆ˜์˜ ๋งˆ์ง€๋ง‰ ๋ถ€๋ถ„์— sep = ' ' ์„ ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด ๋œ๋‹ค. 2023. 2. 17.
[์–ด์„œ์™€ ํŒŒ์ด์ฌ์€ ์ฒ˜์Œ์ด์ง€!_2019 Ver] 3์žฅ Lab ๋„์ „๋ฌธ์ œ ํ’€์ด (1) # 3์žฅ Lab ๋„์ „๋ฌธ์ œ ํ’€์ด (1) 104p_Lab ๋„์ „๋ฌธ์ œ) number = int(input("์ง ๊ฐœ์ˆ˜: ")) total = 0 cnt = 1 for i in range (0, number): weight = int(input("์ง ๋ฌด๊ฒŒ: ")) if (weight > 20) and (cnt == 1): total = total + 20000 cnt = 0 else: continue if number >= 2: total = total + 30000 else: total = total print("๋‚ฉ๋ถ€ํ•˜์‹ค ์ด ๊ธˆ์•ก์€", total, "์›์ž…๋‹ˆ๋‹ค.\n") 105p_Lab ๋„์ „๋ฌธ์ œ) credit = int(input('ํ˜„์žฌ๊นŒ์ง€ ์ด์ˆ˜ํ•˜์‹  ํ•™์ : ')) if credit >= 140: print('์กธ์—… ๊ฐ€.. 2023. 2. 17.
[์–ด์„œ์™€ ํŒŒ์ด์ฌ์€ ์ฒ˜์Œ์ด์ง€!_2019 Ver] 2์žฅ Lab ๋„์ „๋ฌธ์ œ ํ’€์ด # 2์žฅ Lab ๋„์ „๋ฌธ์ œ ํ’€์ด 59p_Lab ๋„์ „๋ฌธ์ œ) x = 3 y = ( x * x * x ) + ( 3 * x * x ) + ( 7 * x ) + 10 print(y) 64p_Lab ๋„์ „๋ฌธ์ œ) # ๋ณต๋ฆฌ ๊ณ„์‚ฐ๊ธฐ init_money = int(input("์›๊ธˆ์„ ์ž…๋ ฅํ•˜์‹œ์˜ค: ")) years = int(input("ํˆฌ์ž ๊ธฐ๊ฐ„์„ ์ž…๋ ฅํ•˜์‹œ์˜ค: ")) interest = float(input("์ด์œจ์„ ์ž…๋ ฅํ•˜์‹œ์˜ค: ")) print("๋ณต๋ฆฌ๋กœ ์›๋ฆฌ๊ธˆ์„ ๊ณ„์‚ฐํ•œ ๊ฒฐ๊ณผ๋Š”", init_money*(1+interest)**years, "์ž…๋‹ˆ๋‹ค.") 74p_Lab ๋„์ „๋ฌธ์ œ) init_book = 28000 #์›๊ฐ€ 2๋งŒ 8000์› dis = 10/100 # 10% ํ• ์ธ final_book = init_book - init_.. 2023. 2. 16.
[์–ด์„œ์™€ ํŒŒ์ด์ฌ์€ ์ฒ˜์Œ์ด์ง€!_2019 Ver] 1์žฅ Lab ๋„์ „๋ฌธ์ œ ํ’€์ด # 1์žฅ Lab ๋„์ „๋ฌธ์ œ ํ’€์ด 35p_Lab ๋„์ „๋ฌธ์ œ) print("์ˆซ์ž ๊ฒŒ์ž„์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.") num = 52 while True: s = input("1~100 ์‚ฌ์ด์˜ ์ˆ˜๋ฅผ ์ž…๋ ฅํ•˜์‹œ์˜ค: ") answer = int(s) if answer == num: print("์ •๋‹ต์ž…๋‹ˆ๋‹ค! ๊ฒŒ์ž„์„ ์ข…๋ฃŒํ•ฉ๋‹ˆ๋‹ค.") break else: if answer > num: print("์˜ค๋‹ต์ž…๋‹ˆ๋‹ค. ์กฐ๊ธˆ ๋” ์ž‘์€ ์ˆ˜๋ฅผ ์„ ํƒํ•˜์„ธ์š”.") else: print("์˜ค๋‹ต์ž…๋‹ˆ๋‹ค. ์กฐ๊ธˆ ๋” ํฐ ์ˆ˜๋ฅผ ์„ ํƒํ•˜์„ธ์š”.") 2023. 2. 16.