[Tutor] Program

Johnson Tran aznjonn at me.com
Wed May 18 14:26:58 CEST 2011


Hi Again All,

I had a couple questions about my program:

def CollectNames():
    
    answer_set=set([])
    sorted_list = sorted(answer_set)
    word=raw_input("Name #1: ")

    word=raw_input("Name #2: ")
    
    word=raw_input("Name #3: ")

    word=raw_input("Name #4: ")

    word=raw_input("Name #5: ") 
    
    print "Your answer's sorted: ", ','.join(sorted_list)

CollectNames()


1.) how do i add each answer given to the list so it is printed at the end? 
2.) also im trying to modify the program so if the user puts in the same name, it will give an make them try again until they have 5 completely different names.


Thanks,

JT


More information about the Tutor mailing list