0

When the function is called count(3,5) then it should display 3,4 and 5.. but my function only seems to show 3 and 4 and not 5?

def count(first,last):
for i in range(first, last):
print i

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Mathhax0r
0

The function range(x,y) returns the list x,x+1,x+2,...,y-1 and stops there. If you wanted to print out x through y in your above function, you should change it to range(first, last+1)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.