#here is the code
def has_33(nums):
for i in range(0,len(nums)-1):
if nums[i:i+2]==[3,3]:
return True
return False
nums = [1,2,3,3]
print(has_33(nums))
questions:
- why the code used
len(nums)-1
in second line?(why used -1 ?) - in the 3rd line why do they used
[i:i+2]==[3,3]
and how does this code perform ?
please let me know , i am basically a noob in coding right now please help me to under stand how this code works