Knowee
Questions
Features
Study Tools

What do these lines print?>>> for i in ["Hello", "Holberton", "School", 98]:>>> print(i, end=" ")0 1 2 31 2 3 4Hello Holberton School 98

Question

What do these lines print?>>> for i in ["Hello", "Holberton", "School", 98]:>>> print(i, end=" ")0 1 2 31 2 3 4Hello Holberton School 98

🧐 Not the exact question you are looking for?Go ask a question

Solution

The given code will print the following:

Hello Holberton School 98

This is because the for loop is iterating over the list ["Hello", "Holberton", "School", 98] and printing each element. The 'end=" "' in the print function is used to print a space after each element instead of a newline, which is the default behavior of the print function.

Similar Questions

What do these lines print?>>> for i in [1, 3, 4, 2]:>>> print(i, end=" ")0 1 2 31 2 3 41 3 4 21 3 4 2 0

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 do these lines print?for i in range(2, 10, 2): print(i, end=" ")2 4 6 84 6 8 10 12 14 16 182 3 4 5 6 7 8 9 102 3 4 5 6 7 8 9

What is the output of the following program?line = "What will have so will" L = line.split('a') for i in L: print(i, end=' ')

What do these lines print?>>> a = [1, 2, 3, 4]>>> a.append(5)>>> len(a)

1/3

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.