I want to create random string filled with "S" and "O". For example, my desired output is like:
SSOSOOSO
OSOOSSOS
SSSOOSSO
OSOSOSOO
With my code I change randomly every line, so what is the way to change every position?
import random
rows = 4
columns = 8
char_list = ['S', 'O']
for i in range(rows):
print(random.choice(char_list) * columns)
My current output:
SSSSSSSS
SSSSSSSS
OOOOOOOO
SSSSSSSS
Aucun commentaire:
Enregistrer un commentaire