While it's certainly possible to do this procedurally (as the comment from HenrikD is suggesting) I think I'd probably do this via material assignment.
It looks like you already have sufficient numbers of faces on the cylinder to pick the appropriate width, so I'd put an all black material on some faces and an all white material on others. The white material is simply the default I get when I press the New material button, and the Black material is that default but with the colour changed to a very dark grey.
First add the two material slots (button marked 1) and then with the slot you want (probably Black, assuming the object starts out White by default), select some faces in Edit mode and press Assign (button marked 2). The Assign button will only show up when actually in Edit mode though.
Here's what this looks like in edit mode (lookdev):
And here's the result in object mode (lookdev) with overlays off:
This way you can specify exactly which faces you'd like black and which faces you'd like white. This works very well for cylinders as they tend to have faces exactly where you want to separate the materials, though you may need to plan ahead to have a number of faces divisible by the number of stripes you want. A procedural solution would not have this issue and would be better in some other ways, but requires more setup and tweaking.
If I needed this to be a single material UV mapped texture, I'd then probably bake it out to a diffuse texture map. I think explaining the process for doing so is a bit long for this answer but you can check out the blender manual on the subject or find one of many video tutorials on that subject, but I'll link one or attempt to expand the answer if requested.