# var1= "one"
# var2= "two"
# var3= "three"
# lst = [var1, var2, var3]
# What you should alway strive to do is to define your initial data in a way that is
# as simple and yet as usable as possible. Here, you want to assign words to numeric
# values, and you also want to be able to go in the other direction, mapping words to
# numeric values (possibly in the form of `var1`, `var1`, etc. Actually defining the
# variables `var1`, `var2`, etc. can serve no purpose over defining a list containing
# the same values as these variables. Using a list means that your code isn't tied to
# the number of items you are processing, and it lets you iterate over the values in
# any way that you want to. If you only use `var1`, `var2`, etc. to set the initial
# values of a list, why not just define the constant values right in the list.
# Here's the most concise way to define your incoming data. It defines each word along
# with a numeric value, the position in the list at which each word is found. This
# will let you do everything you want to do with your data, with the simplest initial
# definition of that data.
data = [ 'one', 'two', 'three']
# You will want to be able to map words back to numeric values, the positions in the
# original 'data' list. To do that, you create a map mapping words to the index
# positions of each word in the original list.
index = { k: i for i, k in enumerate(data) }
# Now it is trivial to map a word back to an index in the original list:
user_input = 'one'
i = index[user_input]
# Your requirements say that you want to print "varN" where N is the Nth
# variable in your code. If you really care about those names, you can
# reconstruct and print the appropriate one as follows:
name = "var" + str(index[user_input] + 1)
print (name)
# This prints the result you desire:
#
# var1
# But why do you need that name? Do you rather just want to map the word back
# to the original storage location with which it was associated. If that's what
# you want, then that's the "i" you just computed above. The storage location
# itself is "data[i]". In a real program, one of these two values, "i" or "data[i]"
# is probably what you're really interested in. The need to introduce an
# arbitrary number of variables in your code, `var1`, `var2`, `var3`. etc. is
# pretty much never what you want.
# A simpler way to look at this is to think about what it would take in your original
# code to support, say, 9 values. You'd have a lot of work to do to add those values,
# and you wouldn't yet be able to get the behavior you want from the code. With the
# solution presented here, you change just one line of code, as follows:
data = [ 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
# and now your code supports the user typing any of these values. you could trivially
# read these values from a file, and then your code wouldn't need to change the code at
# all. That should always be your goal...to keep input data separate from functional code.
# To be able to help you further, we need to know more about what you're trying to
# do here, or what you're trying to represent in a larger program. Tell us more,
# and we can give you more direction.