Printing variable and string on the same line in Python
Start your free 7-days trial now!
To print variables and strings on the same line in Python use the
print(~) method and separate the strings and variables with a comma.
To print a string
"Sky" and a variable
a on the same line:
a = "Towner"print("Sky", a)Sky Towner
Notice that items separated by a
, are printed with a single space in between.