Suppose I have a list li=['project1','project2','project3']
I want to add these values as key to dictionary and value of first key should be completed rest onhold
projects can be any and value of first project in list should be completed rest onhold output required:
dict={'project1':'completed','project2':'onhold','project3':'onhold'}
li=['project1','project2','project3']
for trav_cont in li:
dict[trav_cont]='completed'
zip():my_dict = dict(zip(li, ('completed',) + ('onhold',) * (len(li) - 1))). Do not usedictas name of variable, you're shadowing build-in function.