Python Add to dictionary loop -


When I run the loop, this function adds a name and number to "Phonebook", but for some reason No idea but why can not I get it to work? thanks a lot!

  phonebook = dict (def) addNumber (name, number): i in phonebook: if i == name: print 'error' and: phonebook [name] = number you actually loop Not exactly required, you only need to check the name against the current key of the code in the code> in the code> in Phonebook: Name: print 'error' else: phonebook [name] = number    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -