I'm confused about what you don't understand; what print does or how loops work.
for num in range(5):
print(num)
This is a loop. Loops are used when you want to execute the same code multiple times. This part controls how often the loop executes and also provides a value for num:
for num in range(5)
This is the code that is executed multiple times:
print(num)
The loop is essentially doing this:
print(0)
print(1)
print(2)
print(3)
print(4)
print is a function that evaluates the statement inside the parenthesis and prints it to standard output (or a different destination if specified.