This may be an easy question, but could you tell me how I can print the last element in a range, please ? I did in this way:
for j in range (3):
print(j[2:]) # I only wish to print 2 here
But it says
TypeError: 'int' object is not subscriptable
Could you tell me how to I can get it with this range function, please ?
forloop; just usej = range(3)instead offor j in range(3).numbers = range(3); change the loop tofor j in numbers:, and useprint(numbers[-1])