LogFAQs > #955921740

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
1337toothbrush
07/09/21 7:03:09 PM
#66:


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:


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