[답지] 05. ~ 07. 문제 답지
수정 목록
05.모듈,패키지 교재4쪽 문제
def today_weather() :
return weather_list[0]
05.모듈,패키지 교재5쪽 문제
import weather_data as wd
def forecast_2(afterday):
if afterday == 6 :
return wd.weather_list[afterday]
elif afterday <= 5 :
return wd.weather_list[afterday:afterday+2]
05.모듈,패키지 교재5쪽 문제
mode = input(" Input the mode 't' or 'f' : ")
05.모듈,패키지 교재17쪽 문제 1)
# 뱀 머리가 몸통에 부딪히면 게임 종료
for x in snake_list[:-1]:
if x == snake_head:
game_close = True
05.모듈,패키지 교재17쪽 문제 2)
# 현재 몸통 길이 표시
message(f"Length: {length_of_snake - 1}", red)
05.모듈,패키지 교재17쪽 문제 3)
# 먹이를 먹으면 1) 새로운 먹이 생성, 2)뱀 몸통 길이 1씩 늘이기
if x1 == foodx and y1 == foody:
foodx = round(random.randrange(0, width - snake_block) / 10.0) * 10.0
foody = round(random.randrange(0, height - snake_block) / 10.0) * 10.0
length_of_snake += 1