How do generators work in python? | Sololearn: Learn to code for FREE!
+ 1

How do generators work in python?

1. must generators always be in square brackets? ...eg can they be used to generate strings, tuples or dictionaries? 2. can a generator be multiline? 3. links or examples welcome

6th Oct 2017, 9:42 AM
Ben-Davis
Ben-Davis - avatar
1 ответ
+ 1
Generators are a type of iterable, like lists or tuples.
6th Oct 2017, 10:50 AM
Rishita
Rishita - avatar