2

Let's say we have a list of variables and we want to print the variables names + values in python but without using a dictionary cause the values will be added later on and we don't want to convert from dict to list.

A, B, C, D ,E, F = 10, 20, 15, 50, 16
Census = [A,B,C,D,E,F]

Is it possible to iterate through a list and print out the variables names beside the values and late sum?

Yamel Mauge
  • 35
  • 1
  • 5
  • I don't believe there is. The moment you reference `A`, you get back its value. You should probably just use a dictionary. – pushkin May 08 '18 at 02:56

0 Answers0