How to use for loop with range function.

PHOTO EMBED

Mon Mar 30 2020 07:50:40 GMT+0000 (Coordinated Universal Time)

Saved by @CuriousCoops #python ##python ##pythonlists

  #use for loop and set the range
for index in range(10):
  Print (index)
           
           #when you run this program, the output will be:
               0 
               1 
               2 
               3 
               4 
               5
               6
               7
               8 
               9
                  

content_copyCOPY

In python index starts from 0 so if you set the range 10 it will print 0 to 9 means 10 digits but not including 10.

1. https://www.youtube.com/watch?v=rfscVS0vtbw&t=5s.