input() method allows user to give input.
SYNTAX:
input([prompt])
Parameter:
prompt - Optional. It is a string that display before the input.
var1 = input("Enter any thing: ")
print(var1)
Enter any thing: Hello
Hello
Example:
var1, var2, var3 = input("Enter three values: ").split()
print(var1)
print(var2)
print(var3)
Enter three values: 5 10 15
5
10
15
print() method is used to display object(s) on the screen.
SYNTAX:
print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)
Parameter:
*objects - Any object that will be displayed on the screen.
sep - Separator(optional). Which is used separate the objects. Default is space(' ').
end - Optional. Specifies what will printed at last. Default is new line('\n').
file - Optional. An object with a write method. Default is sys.stdout
flush - Optional. A Boolean, specifying if the output is flushed (True) or buffered (False). Default is False
var1, var2, var3 = 5, 10, 15
print(var1,var2,var3)
5 10 15
var1, var2, var3 = 5, 10, 15
print(var1,var2,var3,sep='-',end='$')
5-10-15$