Hello, can someone please tell me why this simple if ststement dose not run

>>> VList=[0,0,1,0,1,1,0,0]
>>> if VList.count(1) < 5:
	print('Yes')
    else:
         print('No')

The VList.count(1)works so not sure what is wrong, but I think that's were the code is crashing.

Thanks

It works perfect here.

VList=[0,0,1,0,1,1,0,0]
if VList.count(1) < 5:
    print('Yes')
else:
    print('No')

My output:
Yes

You misindented blocks. If and else same indent, the code blocks one indent also same line. The prompt does not count.

In interactive mode:

>>> VList=[0,0,1,0,1,1,0,0]
>>> if VList.count(1) < 5:
	print('Yes')
else:
        print('No')

        
Yes
Be a part of the DaniWeb community

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