range() Exercises

  1. With your neighbor, determine what is displayed for each of the following:
    1. for num in range( 5 ):
          print( num )
      
    2. for num in range( 3 ):
          print( num )
      
    3. for num in range( 2, 7 ):
          print( num )
      
    4. for num in range( 4, 9 ):
          print( num )
      
    5. for num in range( 1, 10, 2 ):
          print( num )
      
    6. for num in range( 1, 11, 2 ):
          print( num )
      
    7. for num in range( 1, 10, 3 ):
          print( num )
      
    8. for num in range( 10, 0, -1 ):
          print( num )
      
    9. for num in range( 10, 0, 3 ):
          print( num )