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

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)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.