+ 2
How to make there be others between the lines of characters using loops (I don't know how to write the question correctly)
Code: for i in range(5): print ('x' * 8) Output: xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx I need: xxxxxxxx xxxxxxxx xxzzzzxx xxxxxxxx xxxxxxxx
3 odpowiedzi
+ 1
for i in range(5):
line = ""
for j in range(8):
if i == 2 and j > 1 and j < 6:
line += "z"
else:
line += "x"
print(line)
+ 2
for i in range(5):
If i == 2:
print(f'{2*"x"}{{4*"z"}{2*"x"}')
Else:
print("x"*8)