Javaexercise.com

Python For Loop Quiz for Beginners

1. What is the for loop in Python?

  •   
  •   
  •   
  •   

2. How to create a for loop in Python?

  •   
  •   
  •   
  •   

3. Can we create nested for loop in Python?

  •   
  •   

4. Why does Python provide the for loop?

  •   
  •   

5. How many numbers of times this for loop will execute?

        a = "python"  
for i in range(1,3,2):  
    print(a)
        
Python
  •   
  •   
  •   
  •   

6. Which keyword is used to create a for loop in Python?

  •   
  •   
  •   
  •   

7. The character that must be at the end of the line for, for-loop etc in Python?

  •   
  •   
  •   
  •   

8. What will be the output after running the for loop in Python?

        a = "python"  
for i in range(1,3,2):  
    pass
        
Python
  •   
  •   

9. How many times does the following code print the word 'python'

        a = "python"  
for i in range(1,3):  
    print(a)
        
Python
  •   
  •   

10. What is will be the output of the below code in Python?

        for i in range(1,3):
    print(i)
print(3+4)
        
Python
  •   
  •   
  •   
  •