Python Forum

Full Version: Changing small letter.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to write generator, which will be change the first letter of the names from list. I have to use "for" and "yield". I thought about something like that:
def names(lis):
    for i in lis:
        yield i.capitalizate()
for Names in names(['john','tom','bruce']):
    print(Names)
But I don't have idea hot to improve this code.
changing
yield i.capitalizate()
to
yield i.capitalize()
will improve the code