Please be gentle with me as im a complete n00b. My favorite language is actually Java which im learning at Uni at the moment. However to throw a spanner in the works they have switched us over to Python, as well as learning Java. My mind has been completely boggled. I just need to understand this for the moment and Im hoping someone out there will be kind enough to help me. I have created a list with names in, and i want to delete what ever name i wish to do so. So i have put a for loop in there. Now I can delete any name WITHOUT the if-statement in there but when i put if statements in there so set either condition to be true or false it doesnt do what i want it to. here is my code:
Any ideas? Thanks :-)
names=(['Paul','Tim','Fred']) def main(): for i in range(len(names)): e=names[i] print names print a = raw_input("Choose name to be deleted:\n") if(a==e) names.remove(a) print "name deleted" if(a!=e): print "No such name!Please Re-enter!"
Edited by woooee