A coordinator needs to contact every 3rd vendor in a list of…
A coordinator needs to contact every 3rd vendor in a list of 30. If vendors are numbered from 1 to 30, which code correctly selects vendor numbers: 1, 4, 7, …? for vendor in range(1, 31, 3): print(vendor)B. for vendor in range(3, 30): print(vendor)C. for vendor in vendors: if vendor % 3 == 0: print(vendor)D. for vendor in range(0, 30, 3): print(vendor + 1) Answer: A Explanation:Option A begins at 1 and increments by 3, selecting every third vendor. B starts at 3, not 1 C selects vendors divisible by 3, not every third D would work but outputs 1, 4, 7… using an offset; A is clearer and more direct.
Read Details