-1

I'm a real beginner and I want to know if there's method where you can assign the keys and values from a dictionary to a list of tuples? If there's a method to do this, I also would like to know the full source code?

This is the given dictionary

dict_count = {'z': 4, 'b': 4, 'a': 6}

I expect the output to look like this [(‘a’ 6), (‘b’ 4), (‘z’, 4)]

Vincent.N
  • 141
  • 1
  • 10

1 Answers1

1

But please do not use dict as an identifier! It is a built-in function (a dictionary constructor).

list(d.items())
#[('z', 4), ('b', 4), ('a', 6)]
DYZ
  • 55,249
  • 10
  • 64
  • 93