0

I am trying to print the value stored in a variable without directly using the variable name

var1_str = "NASA"
var2 = "var1"
print (var2 + "_str")

The above code prints the string var1_str as output. However, I need it to print the string "NASA". I need to use (var2 + "_str") and print the value assigned for var1. I cannot directly call var1_str variable due to a requirement.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197

0 Answers0