The type can be used with format codes: 'd' for integers. 'f' for floating-point numbers. 'b' for binary numbers. 'o' for octal numbers.

variable = 14 string = "Variable as integer = %d \n\ Variable as float = %f" %(variable, variable) print (string)

String formatting python program