how to transfer dictionary value into a tuple?

Viewed 15

could anyone help me with tranforming dictionary values into a tuple please. The dictionary:

dic = {'a': 1, 'b':2, 'c':3, 'd':4}

and im looking to get output only values as tuple:

tup = (1, 2, 3, 4)
1 Answers

Just access the dict values, then make it a tuple:

dic = tuple(dic.values())

Related