Predict the result for python statement:>>>print(1,2,3,4,sep='#'end='&')
Answers
Answered by
11
>>> print(1, 2, 3, 4, sep = '#', end = '&')
Output:
1#2#3#4&
What 'sep' does is separate the values in the print statement with whatever character has been stored in it.
In this case, we've given a hash symbol to be used in between/to separate each value.
On the other hand, 'end' displays the stored character at the end, once all the values have been printed.
That is why you see the '&' symbol in the end, after all the values.
Both functions are commonly used for creating designs, maintaining alignment, and so on.
Similar questions