0

How would I be able to replace the array string into actual value programmatically without hardcoding it in python.

test[0] = "david"
test[1] = "23"
test[2] = "thank you"


my_string = "Hi, my name is test[0] and I am test[2] years old"

output: Hi, my name is david and I am 23 years old

suthan
  • 1
  • 2

1 Answers1

0
my_string = f"Hi, my name is {test[0]} and I am {test[2]} years old"