* main.py from turtle import Screen from snake import Snake from food import Food from scoreboard import Scoreboard import time screen = Screen() screen.setup(width=600, height=600) screen.bgcolor("black") screen.tracer(0) screen.title("kio's snake game - ver.20220302(the first one)") snake = Snake() food = Food() scoreboard = Scoreboard() screen.listen() screen.onkey(snake.up, "Up") screen.onke..

print(piano[2:5]) #2부터 5앞까지 >> c, d, e print(piano[2:]) #2부터 끝까지 >> c, d, e, f, g print(piano[:5]) #처음부터 5앞까지 >> a, b, c, d, e print(piano[2:5:2]) #2부터 5앞까지 step 2 >> c, e print(piano[::2]) #처음부터 끝까지 step 2 >> a, c, e, g print(piano[::-1]) #처음부터 끝까지 reverse >> g, f, e, d, c, b, a slicing은 [] 리스트 외에 () 튜플에서도 동일하게 적용된다. piano_tuple = ("do", "re", "mi", "fa", "so", "la", "ti") * main.py 의 아래 부분을 #꼬..
* main.py from turtle import Screen from snake import Snake from food import Food from scoreboard import Scoreboard import time screen = Screen() screen.setup(width=600, height=600) screen.bgcolor("black") screen.tracer(0) screen.title("kio's snake game - ver.20220223(the first one)") snake = Snake() food = Food() scoreboard = Scoreboard() screen.listen() screen.onkey(snake.up, "Up") screen.onke..

* main.py from turtle import Screen from snake import Snake from food import Food from scoreboard import Scoreboard import time screen = Screen() screen.setup(width=600, height=600) screen.bgcolor("black") screen.tracer(0) screen.title("kio's snake game - ver.20220223(the first one)") snake = Snake() food = Food() scoreboard = Scoreboard() screen.listen() screen.onkey(snake.up, "Up") screen.onke..

* main.py from turtle import Turtle ALIGNMENT = "center" FONT = ("Arial", 24, "normal") class Scoreboard(Turtle): def __init__(self): super().__init__() self.yumyum = 0 self.goto(0,265) self.color("white") self.pu() self.hideturtle() self.score() def score(self): self.write(f"Score: {self.yumyum}", align=ALIGNMENT, font=FONT) self.yumyum += 1 * snake.py from turtle import Turtle STARTING_POSITIO..

class Animal: def __init__(self): self.num_eyes = 2 def breathe(self): print("Inhale, exhale.") class Fish(Animal): def __init__(self): super().__init__() def breathe(self): super().breathe() # 상위 class의 method는 그대로 계승하면서 print("doing this underwater.") # 프린트하는 별개 기능을 추가할 수 있음 def swim(self): print("moving in water.") nemo = Fish() nemo.breathe() nemo.swim() [ 실행 결과 ] Inhale, exhale. --> 상속받은 부분..
프로그램을 클래스로 분해해서 만들어보자. *snake.py *food.py *scoreboard.py [main.py] from turtle import Screen, Turtle from snake import Snake import time screen = Screen() screen.setup(width=600, height=600) screen.bgcolor("black") screen.tracer(0) screen.title("kio's snake game - ver.20220223(e first one)") snake = Snake() screen.listen() screen.onkey(snake.up, "Up") screen.onkey(snake.down, "Down") screen.onke..
- Total
- Today
- Yesterday
- 변수화
- insert
- 읽어오기
- 부동없이
- virt-sysprep
- 대소문자
- EXA
- 차집합
- powercli
- vmware.powercli
- 배열
- dp-1
- vmware
- dp-2
- 3par
- storage
- dezoomify
- oracle
- set()
- artandculture
- sysprep
- exadata
- fromkeys
- cloud-init
- LIST
- 정렬
- 스토리지
- 중복제거
- Join
- powershell
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |