# while loop
#
# Write a while loop that is initialized at 0 and stops at 15.
# If the counter is an even number, append the counter to
# a list called eve_nums.
eve_nums = []
start = 0
stop = 15
while start <= stop:
if start % 2 == 0:
eve_nums.append(start)
start += 1
print(eve_nums) # 0도 짝수임
# 결과
[0, 2, 4, 6, 8, 10, 12, 14]
댓글 영역