1print("Hello, World!") #Output: Hello, World!
2
3print(5+5) # Output:10
4
5x=10
6y=11
7print(x+y) #Output: 21
1# sep is between each item. empty string disables it.
2print('hello', 'world', sep='')
3##helloworld
4
5# end is placed at the end of the statement. defaults to '\n' (line break)
6print('The first sentence', end='. ')
7print('The second sentence', end='. ')
8##The first sentence. The second sentence.
9
10# file allows you to change where it sends the data
11with open('file.txt', mode='w') as file_object:
12 print('hello world', file=file_object)
13## this would print "hello world" to a file named "file.txt"
14# note: you can't use print for anything that isn't a character.
15
16# use flush to disable buffering:
17print(countdown, end='...', flush=True)
1Print("Hello") Print("World") #Output: Hello World!
2
3print(5+5) # Output:10
4
5x=10
6y=11
7print(x+y) #Output: 21