
Генераторы2
Quiz
•
Science
•
5th Grade
•
Medium
Igor Perekalskiy
Used 2+ times
FREE Resource
Enhance your content in a minute
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Генераторы
работают только один раз. Можно ли изменить данное поведение у генераторов?
Чтобы создать объект, допускающий повторные итерации, стоит определить его как класс и
сделать метод iter() генератором
Чтобы создать объект, допускающий повторные итерации, стоит определить его как класс и
сделать метод next() генератором
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Неотъемлемое свойство генераторов в том, что функция с yield
никогда не выполняется
сама по себе. Ею всегда должен управлять другой код с циклом for или явными вызовами
функции next()
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Что позволяет команда yield from
помогает избавится от необходимости управлять перебором вручную.
переход к следующей иттерации.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Итератор (iterator) - это объект, который возвращает свои элементы?
по одному за раз
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Что выдаст код?
a = 'hello'
iterator = iter(a)
print(next(iterator))
print(next(iterator))
print(next(iterator))
print(next(iterator))
print(next(iterator))
print(next(iterator))
Когда мы перебрали весь объект, то на следующей итерации мы видим исключение
StopIteration.
h
e
l
l
o
Similar Resources on Wayground
10 questions
Climate vs. Weather
Quiz
•
5th Grade
10 questions
Predicting Weather
Quiz
•
5th Grade
10 questions
Steps of the Scientific Method
Quiz
•
3rd - 5th Grade
10 questions
Plant Growth
Quiz
•
5th - 8th Grade
10 questions
Science Safety
Quiz
•
5th Grade
10 questions
Science STAAR Review A
Quiz
•
5th Grade
10 questions
5.8C Earth's Rotation
Quiz
•
5th Grade
10 questions
Weather Disturbances
Quiz
•
5th Grade
Popular Resources on Wayground
10 questions
Honoring the Significance of Veterans Day
Interactive video
•
6th - 10th Grade
10 questions
Exploring Veterans Day: Facts and Celebrations for Kids
Interactive video
•
6th - 10th Grade
19 questions
Veterans Day
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Circuits, Light Energy, and Forces
Quiz
•
5th Grade
6 questions
FOREST Self-Discipline
Lesson
•
1st - 5th Grade
7 questions
Veteran's Day
Interactive video
•
3rd Grade
20 questions
Weekly Prefix check #2
Quiz
•
4th - 7th Grade
Discover more resources for Science
15 questions
Circuits, Light Energy, and Forces
Quiz
•
5th Grade
20 questions
Physical and Chemical Changes
Quiz
•
5th Grade
22 questions
Light Energy
Quiz
•
5th Grade
20 questions
Weather vs. Climate
Quiz
•
5th Grade
17 questions
Animal and Plant Cells
Quiz
•
5th Grade
13 questions
Reflect, refract, and absorb
Quiz
•
3rd - 5th Grade
20 questions
S5L2b (inherited & acquired traits)
Quiz
•
5th Grade
16 questions
How light behaves 5.6C
Quiz
•
5th Grade
