Skip to main content
variable = 42 user_input = "The answer is {variable}" # in order to get The answer is 42, we can follow this method print (user_input.format(variable=variable)) 

(or)

user_input_formatted = user_input.format(variable=variable) print (user_input_formatted) 

Good link https://cito.github.io/blog/f-strings/

priya raj
  • 362
  • 2
  • 8