Skip to content
Advertisement

Printing variables and strings in Python

I am trying to print the following lines :

‘My name is John Smith.’

‘My name is John Smith, and I live in CHICAGO’

and I live in chicago’

My code below :

JavaScript

How can I get the results from the top?

Advertisement

Answer

JavaScript

Output:

My name is john smith, and I live in chicago. I am 25 years old.

By the way i recommend you to read this article: https://realpython.com/python-string-formatting/

Advertisement