Home - nagarajaprabha/pythonML GitHub Wiki

Python Basics

  1. To create Dictionary from a List #Create List studentList = ["Steven", "Allen", "Alex", "Lee", "Neena"] #Create Index Range studIndx = list(range(len(studentList))) #Zip the List + Index stuZip = zip(studentList,studIndx) #creates tupple, iterates through loop #Create Dictionary studDict = dict(stuZip)