I am new and this is possibly a newbie question. I am using Python. So here's the code:
def student_list (names):
unique = [ ]
for name in names:
if name not in unique:
unique.append(name)
return unique
print(name)
def listToString(names):
str1 = " "
return (str1.join(names))
names = ["Adam", "Ben", "Aaron", "Clyde", "Alex", "Billy", "Chris", "Adam", "Clyde"]
names.sort()
print(listToString(student_list(names)))
The code will result in:
Aaron Adam Alex Ben Billy Chris Clyde
But what I want to achieve is:
Aaron
Adam
Alex
Ben
Billy
Chris
Clyde
Also a side question, is it possible to have two for-loops within a nested function?
Thank you.