How to Insert Numbers Into Strings in Python


In this example we will show how to insert numbers into strings using the format() method in Python.

Source Code

 insert numbers into strings
price = 12

print('The price is {}.'.format(price))

Output:

The price is 12.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments