<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Title
Step1:  Now we have a problem, we were only returned the name of the first student. Why? Because the function only ran the for name in names iteration once!
Create A Generator
A generator is a function, but instead of returning the return, instead returns an iterator. The generator below is exactly the same as the function above except I have replaced return with yield (which defines whether a function with a regular function or a generator function).
Step2:  Everything has been the same so far, but now things get interesting. Above when we ran students when it was a function, it returned one name. However, now that students refers to a generator, it yields a generator object of names!
Step3:  What can we do this a generator object? A lot! As a generator students will can each student in the list of students
Step4:  It is interesting to note that if we use list(students) we can see all the students still remaining in the generator object's iteration
<ASSISTANT_TASK:>
Python Code:
# Create a function that
def function(names):
    # For each name in a list of names
    for name in names:
        # Returns the name
        return name
# Create a variable of that function
students = function(['Abe', 'Bob', 'Christina', 'Derek', 'Eleanor'])
# Run the function
students
Explanation: Title: Functions Vs. Generators
Slug: functions_vs_generators
Summary: Functions Vs. Generators in Python.  
Date: 2016-01-23 12:00
Category: Python
Tags: Basics  
Authors: Chris Albon  
Interesting in learning more? Check out Fluent Python
Create A Function
End of explanation
# Create a generator that
def generator(names):
    # For each name in a list of names
    for name in names:
        # Yields a generator object
        yield name
# Same as above, create a variable for the generator
students = generator(['Abe', 'Bob', 'Christina', 'Derek', 'Eleanor'])
Explanation: Now we have a problem, we were only returned the name of the first student. Why? Because the function only ran the for name in names iteration once!
Create A Generator
A generator is a function, but instead of returning the return, instead returns an iterator. The generator below is exactly the same as the function above except I have replaced return with yield (which defines whether a function with a regular function or a generator function).
End of explanation
# Run the generator
students
Explanation: Everything has been the same so far, but now things get interesting. Above when we ran students when it was a function, it returned one name. However, now that students refers to a generator, it yields a generator object of names!
End of explanation
# Return the next student
next(students)
# Return the next student
next(students)
# Return the next student
next(students)
Explanation: What can we do this a generator object? A lot! As a generator students will can each student in the list of students:
End of explanation
# List all remaining students in the generator
list(students)
Explanation: It is interesting to note that if we use list(students) we can see all the students still remaining in the generator object's iteration:
End of explanation
<END_TASK>