Python for Data Science / Quiz
Python Loops
Python Loops Quiz
5 questions
- Consider the following while loop:
i = 0 while i < 5 : print(i) i = i + 1How many prints will this while loop do?
- What will be the output of the following for loop?
stocks = ['GOOG', 'AAPL'] for stock in stocks: stock print(stocks)
- What is the output of the following?
i = 1 while True: if i%3 == 0: break print(i) i += 1
- What will be the output of the following code?
data = [30, 40, 50, 70, 60] bigdata = [] for item in data: if item > 50: bigdata.append(item)
print (bigdata)
- Which of the following methods is used to loop over a Python dictionary?
5 left