Instructions
- 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
- 2. Thoroughly review each solution before proceeding to ensure full understanding.
- 3. Final results will be available after submission to provide insights into areas for further improvement.
- 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
- 5. Once submitted, responses are final, so ensure you’re confident in your answers.
- 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.
All Problems
Question
Action
What will be the output of this code? for i in range(3): print(i) else: print("Done")
What is the purpose of the iter() function?
What will be the output of this code? for i in [1, 2, 3]: for j in [4, 5]: print(i + j)
Which of the following methods returns the next item from an iterator?
What will be the output of this code? my_list = [1, 2, 3]; my_iter = iter(my_list); print(next(my_iter))
Which of the following is NOT a valid way to iterate over a list?
What is the purpose of the break statement in a loop?
What is the output of this code? for x in range(5): if x == 3: break; print(x)
What is the output of this code? for i in range(2): for j in range(2): print(i, j)
How can you iterate over the keys of a dictionary?