νμ΄μ¬ λ¬Έλ²
-
λ€μ€ μμ • μ¬λ¬ κ°μ ν΄λμ€λ‘λΆν° μμλ°λ κ²½μ° νμ΄μ¬μ λ€μ€ μμμ μ§μνκ³ λΆλͺ¨ ν΄λμ€μ λμΌν λ©μλλ μμ±μ΄ μμ λλ μΌμͺ½μμλΆν° μ°μ κΆ μ λΆμ¬ νλ€. μμ ) #1 μμ class Person: def greeting(self): print('μλ νμΈμ.') class University: def manage_credit(self): print('νμ κ΄λ¦¬') class Undergraduate(Person, University): def study(self): print('곡λΆνκΈ°') sunja = Undergraduate() sunja.greeting() sunja.manage_credit() sunja.study() #2 μμ class Person: def sleep(self): pr..
[Python] λ€μ€μμ, μΆμν΄λμ€λ€μ€ μμ • μ¬λ¬ κ°μ ν΄λμ€λ‘λΆν° μμλ°λ κ²½μ° νμ΄μ¬μ λ€μ€ μμμ μ§μνκ³ λΆλͺ¨ ν΄λμ€μ λμΌν λ©μλλ μμ±μ΄ μμ λλ μΌμͺ½μμλΆν° μ°μ κΆ μ λΆμ¬ νλ€. μμ ) #1 μμ class Person: def greeting(self): print('μλ νμΈμ.') class University: def manage_credit(self): print('νμ κ΄λ¦¬') class Undergraduate(Person, University): def study(self): print('곡λΆνκΈ°') sunja = Undergraduate() sunja.greeting() sunja.manage_credit() sunja.study() #2 μμ class Person: def sleep(self): pr..
2020.11.24 -
νμ΄μ¬μ λμ€μ μ½λλ₯Ό ν¨μ¨μ μΌλ‘ μ°κ² κ°λ¨ν λ¬Έλ²μ κ°μΈμ μΌλ‘ 곡λΆνλ κ²μ λλ€. 1. up down κ²μ import random t = 0 #μλ νμ guess = 0 #μ λ ₯λ°λκ° answer = random.randint(1,100) #λλ€ν μ print(answer) while 1: print("κ°μ μ λ ₯ νμΈμ.") guess = input() t = t+1 if int(guess) int(answer): print("λ μκ° λ λμ") else: print("μ λ΅~ μ§μ§μ§") print("μλ νμλ %d λ² μ λλ€."%t) break 2. κ΅¬κ΅¬λ¨ μμκ² μ§κΈ° for i in range..
[Python] up downκ²μ, κ·ΈμΈ μ°μ΅ μ½λνμ΄μ¬μ λμ€μ μ½λλ₯Ό ν¨μ¨μ μΌλ‘ μ°κ² κ°λ¨ν λ¬Έλ²μ κ°μΈμ μΌλ‘ 곡λΆνλ κ²μ λλ€. 1. up down κ²μ import random t = 0 #μλ νμ guess = 0 #μ λ ₯λ°λκ° answer = random.randint(1,100) #λλ€ν μ print(answer) while 1: print("κ°μ μ λ ₯ νμΈμ.") guess = input() t = t+1 if int(guess) int(answer): print("λ μκ° λ λμ") else: print("μ λ΅~ μ§μ§μ§") print("μλ νμλ %d λ² μ λλ€."%t) break 2. κ΅¬κ΅¬λ¨ μμκ² μ§κΈ° for i in range..
2020.09.29