A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/quizzes/python-for-loop-quiz/ below:

Quiz about Python for loop quiz

What is the purpose of the range function in a for loop?

What is the purpose of the enumerate function in a for loop?

How can you iterate over a string in reverse order using a for loop?

What will the following code output?

numbers = [3, 7, 2, 8, 5]
for i, num in enumerate(numbers):
   if i == num:
       break
   print(num, end=' ')
 

What is the purpose of the else clause in a for loop?

What will the following code output?

for char in 'hello':
   if char == 'l':
       break
   print(char, end=' ')
 

What will the following code output?

numbers = [1, 2, 3, 4, 5]
for i, num in enumerate(numbers):
   if i % 2 == 0:
       continue
   print(num, end=' ')
 

What will the following code output?

numbers = [1, 2, 3, 4, 5]
for i in range(len(numbers) - 1, -1, -1):
   print(numbers[i], end=' ')
 

How can you iterate over the indices and values of a list using a for loop?

How can you iterate over a tuple using a for loop?

There are 24 questions to complete.

Take a part in the ongoing discussion


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4