Knowee
Questions
Features
Study Tools

What will be the output for the following print statements?print(1,2,3,4,sep="*")print(1,2,3,4,sep="#",end="@")

Question

What will be the output for the following print statements?

print(1,2,3,4,sep="*")
print(1,2,3,4,sep="#",end="@")
🧐 Not the exact question you are looking for?Go ask a question

Solution

The output for the first print statement print(1,2,3,4,sep="*") will be 1*2*3*4. This is because the sep="*" argument changes the default separator between values from a space to an asterisk.

The output for the second print statement print(1,2,3,4,sep="#",end="@") will be 1#2#3#4@. This is because the sep="#" argument changes the default separator between values from a space to a hash symbol, and the end="@" argument changes the default ending of the print statement from a newline to an at symbol.

This problem has been solved

Similar Questions

correct answerWhat will be the output of the following Python code?print('*', "abcde".center(6), '*', sep='')

What will be the output of the following code?i = 3for i in range (4)      print (i)

What do theseWhat do these lines print?>>> for i in range(1, 4):>>> print(i, end=" ")1 2 30 1 2 31 2 3 4

What output will the following Python statements produce?>>> print (2*(3 - 1))Question 5Select one:a.6b.5c.4d.3

What will be printed by the following code?for i in range(5):    for j in range(5, 0, -1):        if i == j:            print(i, end=" ")1 2 3 44 3 2 1 004

1/4

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.