Get input from user and display (input’s type is string):

age = input("Your age? ") # python 3, raw_input for python 2
print("Your age:", age) # don't need space after "age"

Get the input and store to numbers list

numbers = list(map(int, input().split()))

Get multi inputs on 1 line:

x, y, z, n = (int(input()) for _ in range(4))

Print normally:

print("Hello!") # python 3
print "Hello!" # python 2

Print with format:

print("Hello {} and {}.".format("A", "B"))
Hello A and B.

Change the order:

print("Hello {2} and {1}.".format("A", "B"))
Hello B and A.

Directly insert (python 3.6 or above):

b = "B"
print(f'Hello {"A"} and {b}.')
Hello A and B.

Print up to number of decimals:

number = 1

They are separated by spaces.

print("1", 5, "thi")
1 5 thi

Notice an error?

Everything on this site is published on Github. Just summit a suggested change or email me directly (don't forget to include the URL containing the bug), I will fix it.