-3

If
x= Apple y = 0123

How can I create a new variable Apple0123 using x & y?

so basically: COMBINE(x,y) = 5

and if i type in Apple0123 -> the output is 5

  • 1
    Really, you _don't_ want to do this. Please see [How do I create a variable number of variables?](https://stackoverflow.com/questions/1373164/how-do-i-create-a-variable-number-of-variables). Also see [How can I create lists from a list of strings?](https://stackoverflow.com/questions/14241133/how-can-i-create-lists-from-a-list-of-strings). – PM 2Ring Jun 06 '17 at 18:00
  • 1
    Possible duplicate of [How do I create a variable number of variables?](https://stackoverflow.com/questions/1373164/how-do-i-create-a-variable-number-of-variables) – il_raffa Jun 06 '17 at 20:02

1 Answers1

0
x = 'Apple'
y = '0123'
x+y
exec("%s = %d" % ((x+y),5))
print(Apple0123)

or

x = 'Apple'
y = '0123'
x+y
vars()[x+y]
print(Apple0123)
Arya McCarthy
  • 8,554
  • 4
  • 34
  • 56
joshua
  • 28
  • 8