call a Python range() using range(start, stop, step)
# welcome to softhunt.net
# Python program to
# print all number
# divisible by 5 and 7
# using range to print number
# divisible by 5
print('divisible by 5: ')
for i in range(0, 30, 5):
print(i, end=" ")
print()
# using range to print number
# divisible by 7
print('divisible by 7: ')
for i in range(0, 50, 7):
print(i, end=" ")
print()
# welcome to softhunt.net
# Python program to
# print whole number
# using range()
# printing first 5
# whole number
print('printing first 5: ')
for i in range(5):
print(i, end=" ")
print()
# printing first 10
# whole number
print('printing first 10 :')
for i in range(10):
print(i, end=" ")
print()
# welcome to softhunt.net
# Python program to
# print natural number
# using range
# printing a natural
# number upto 20
print('printing a natural upto 20 :')
for i in range(1, 21):
print(i, end=" ")
print()
# printing a natural
# number from 5 to 20
print('printing a natural from 10 to 20 :')
for i in range(10, 21):
print(i, end=" ")
print()
call a Python range() using range(start, stop, step)
# welcome to softhunt.net
# Python program to
# print all number
# divisible by 5 and 7
# using range to print number
# divisible by 5
print('divisible by 5: ')
for i in range(0, 30, 5):
print(i, end=" ")
print()
# using range to print number
# divisible by 7
print('divisible by 7: ')
for i in range(0, 50, 7):
print(i, end=" ")
print()
# welcome to softhunt.net
# Python program to
# print whole number
# using range()
# printing first 5
# whole number
print('printing first 5: ')
for i in range(5):
print(i, end=" ")
print()
# printing first 10
# whole number
print('printing first 10 :')
for i in range(10):
print(i, end=" ")
print()
# welcome to softhunt.net
# Python program to
# print natural number
# using range
# printing a natural
# number upto 20
print('printing a natural upto 20 :')
for i in range(1, 21):
print(i, end=" ")
print()
# printing a natural
# number from 5 to 20
print('printing a natural from 10 to 20 :')
for i in range(10, 21):
print(i, end=" ")
print()