Предмет: Информатика,
автор: voroda112
a=[]
for i in range(8,100,8):
i=i%3
a. append(i)
Ответы
Автор ответа:
0
There seems to be an error in the given code.
First, the list a is not initialized. It should be initialized as a = [] before the loop.
Secondly, the line i=i%3 does not make sense in this context because i is being overwritten in each iteration of the loop, and not used anywhere else in the loop.
Assuming that the correct variable name is a and the goal is to append the remainder of each number in the range 8 to 99 (inclusive) when divided by 3, the corrected code should be:
a = []
for i in range(8,100,8):
a.append(i%3)
This will create a list a with 12 elements, each element representing the remainder when the corresponding number in the range 8 to 99 (inclusive) is divided by 3
Похожие вопросы
Предмет: История,
автор: msimka91
Предмет: Физика,
автор: julia2721
Предмет: Другие предметы,
автор: virtvirtcountry1212
Предмет: Русский язык,
автор: jasursaidov1804
Предмет: Русский язык,
автор: milananekrasovakosh