range() function in python does not include the stop value. Write a generator function equivalent to range() function that includes the stop value also. The function will take three arguments start, stop and step and will generate the desired list.
Answers
Answered by
1
Explanation:
# Python program to
# print all number
# divisible by 3 and 5
# using range to print number
# divisible by 3
for i in range(0, 30, 3):
print(i, end = " ")
print()
# using range to print number
# divisible by 5
for i in range(0, 50, 5):
print(i, end = " ")
Output :
0 3 6 9 12 15 18 21 24 27
0 5 10 15 20 25 30 35 40 45
Similar questions