Y.G. Bae (35) [Avatar] Offline
I am just wondering whether it would be more efficient just to call the "name" variable again in the last line because the existing for loop already catches the last name in the iteration after the last space:

names = input("Tell me some names, separated by spaces: ")
name = ""
for ch in names:
    if ch == " ":
        print("Hi", name)
        name = ""
        name += ch
# deal with the last name given (does not have a space after it)
print("Hi", name)
Ana Bell (27) [Avatar] Offline
You're right, that would be simpler and more "pythonic"!