placeholder python code example
Example 1: formatting in python
>>> name = "John"
>>> age = 19
>>> language = "python"
>>> print(f"{name} of age {age} programs in {language}")
John of age 19 programs in python
>>> print("%s of age %d programs in %s" %(name, age, language))
John of age 19 programs in python
>>> print("{} of age {} programs in {}".format(name, age, language))
John of age 19 programs in python
>>> print("{2} of age {1} programs in {0}".format(name, age, language))
python of age 19 programs in John
Example 2: string formatting in python
name = "Foo"
age = 12
print(f"Hello, My name is {name} and I'm {age} years old.")
Example 3: python format strings
print(f"string {adjustable_input_1} more string {adjustable_input_2}")
name = "Joe Bob"
age = 23
print(f"My name is {name} and I am {age} years old")
--> My name is Joe Bob and I am 23 years old