
Генераторы2
Quiz
•
Science
•
5th Grade
•
Practice Problem
•
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
from Earth's Water Cycle
Quiz
•
5th Grade
10 questions
Global Winds
Quiz
•
5th Grade
10 questions
Inferring!
Quiz
•
1st - 6th Grade
10 questions
ESS.5.1.1 (5.E.1.1) #3 Schoolnet
Quiz
•
5th Grade
10 questions
Static Electricity Assessment
Quiz
•
5th Grade - University
10 questions
5.E.1.2 #3
Quiz
•
5th Grade
10 questions
Series and Parallel Circuit
Quiz
•
4th - 5th Grade
10 questions
Engineering Design Process
Quiz
•
2nd - 5th Grade
Popular Resources on Wayground
10 questions
Honoring the Significance of Veterans Day
Interactive video
•
6th - 10th Grade
9 questions
FOREST Community of Caring
Lesson
•
1st - 5th Grade
10 questions
Exploring Veterans Day: Facts and Celebrations for Kids
Interactive video
•
6th - 10th Grade
19 questions
Veterans Day
Quiz
•
5th Grade
14 questions
General Technology Use Quiz
Quiz
•
8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Circuits, Light Energy, and Forces
Quiz
•
5th Grade
19 questions
Thanksgiving Trivia
Quiz
•
6th Grade
Discover more resources for Science
15 questions
Circuits, Light Energy, and Forces
Quiz
•
5th Grade
20 questions
Light Energy
Quiz
•
5th Grade
20 questions
Physical and Chemical Changes
Quiz
•
5th Grade
17 questions
Apparent Movement of the Sun and Shadows (5.8C)
Quiz
•
5th Grade
25 questions
instinct vs learned behavior
Quiz
•
5th Grade
23 questions
Water Cycle
Quiz
•
5th - 6th Grade
25 questions
Modeling Matter - Chapter 2 Quiz Review
Quiz
•
5th Grade
16 questions
Light Energy
Quiz
•
5th Grade
