Output
The print function prints output to the console.
hello.py
print("Hello World!")
Terminal
$ python hello.py
Output
Hello World!
Objects are automatically converted to string representations for printing.
String concatenation is the operation of joining character strings. In Python, there are several ways to concatenation strings.
print("hello","world")
print("hello" + " " + "world")
print("{0} {1}".format("hello","world"))
Python 3.6 introduced format literals, with a more elegant syntax (less redundancy).
greeting = "hello"
who = "humans"
print(f"{greeting} {who}")
Last modified 4yr ago