LogFAQs > #955922776

LurkerFAQs, Active DB, DB1, DB2, DB3, DB4, DB5, DB6, DB7, Database 8 ( 02.18.2021-09-28-2021 ), DB9, DB10, DB11, DB12, Clear
Topic List
Page List: 1
TopicITT: Learning Python
SpiritSephiroth
07/09/21 7:36:41 PM
#67:


1337toothbrush posted...
One thing you'll want to get used to is working with collections (e.g. lists, dictionaries). They help a ton with making your code more automated instead of dealing with contact1, contact2, contact3 like in your example.

Here is the same example you wrote but with putting the contacts into a list instead of individual variables: https://ideone.com/nGtsdl

As you can see, printing the objects out is a simple matter of iterating through a list. This is important when you start dealing in the hundreds, thousands, millions, etc of objects.

Here is the code in image form:

Thanks, this looks pretty useful, I'll save it.

---
... Copied to Clipboard!
Topic List
Page List: 1