Hints & Tips on Learning Python.

Here are some Python hints/tips that i have come across when learning to program Python and i thought to share them with you.
These small little Python code snippets that will enhance your bigger Python applications as you grow as a Python programmer.
Python Code example 1)...
#Printing more than one list’s items simultaneoulsy
list1 = [1,3,5,7]
list2 = [2,4,5,6]
for a, b in zip(list1,list2):
print (a, b)
# zip() function takes two equal length lists and mergers them together in pairs
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Python Code example 2)...
#Partition a list into number of groups
mylist = [‘Moon’, ‘Trees’, ‘Monkeys’, ‘Humans’, ‘Black’, ‘White’]
groups = list(zip ([iter(mylist)] * 2))
print (group)