Python Forum
having dictionary and list to iterate in for loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
having dictionary and list to iterate in for loop
#2
for i, k in enumerate(dic.keys()):
    n[k] = dic[k] + ls[i]
Did you try your code? What does happen when you run it?
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
RE: having dictionary and list to iterate in for loop - by wavic - Jan-04-2017, 08:20 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sort a list of dictionaries by the only dictionary key Calab 2 685 Apr-29-2024, 04:38 PM
Last Post: Calab
  Dictionary in a list bashage 2 625 Dec-27-2023, 04:04 PM
Last Post: deanhystad
  filtering a list of dictionary as per given criteria jss 5 778 Dec-23-2023, 08:47 AM
Last Post: Gribouillis
  How to add list to dictionary? Kull_Khan 3 1,064 Apr-04-2023, 08:35 AM
Last Post: ClaytonMorrison
  iterate through the dict_values while unpacking the dictionary PeacockOpenminded 3 1,358 Jan-22-2023, 12:44 PM
Last Post: PeacockOpenminded
  check if element is in a list in a dictionary value ambrozote 4 2,065 May-11-2022, 06:05 PM
Last Post: deanhystad
  Dictionary from a list failed, help needed leoahum 7 2,079 Apr-28-2022, 06:59 AM
Last Post: buran
  how to assign items from a list to a dictionary CompleteNewb 3 1,649 Mar-19-2022, 01:25 AM
Last Post: deanhystad
  Python, how to manage multiple data in list or dictionary with calculations and FIFO Mikeardy 8 2,717 Dec-31-2021, 07:47 AM
Last Post: Mikeardy
  For Loop and Use of Brackets to Modify Dictionary in Tic-Tac-Toe Game new_coder_231013 7 2,353 Dec-28-2021, 11:32 AM
Last Post: new_coder_231013

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020