Demonstrates the range() function : Random « Development « Python






Demonstrates the range() function

Demonstrates the range() function
 

print "Counting:"
for i in range(10):
    print i,

print "\n\nCounting by fives:"
for i in range(0, 50, 5):
    print i,

print "\n\nCounting backwards:"
for i in range(10, 0, -1):
    print i,

   
  








Related examples in the same category

1.Demonstrates random number generation
2.Random integers produced by randrange.Random integers produced by randrange.
3.random number generationrandom number generation
4.Random Choice Random Choice
5.Sampling without replacementSampling without replacement
6.Random int value
7.Random floatRandom float
8.Random string value
9.Random integer chosen from range(6)Random integer chosen from range(6)