How do generators work in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do generators work in python?

1. must generators always be in square brackets? 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 - avatar
1 Answer
+ 1
Generators are a type of iterable, like lists or tuples.
6th Oct 2017, 10:50 AM
Rishita - avatar