Input: ABCDEFGHIJKLIMNOQRSTUVWXYZ
This is my input. Now I want my output to print in this format:
Expected Output: ABC DEF GHI JKL MNO PQR STU VWX YZ
CodePudding user response:
count = 0
for char in input_str:
count =1
if count % 3 == 0:
print(char, end=' ')
else:
print(char, end='')
CodePudding user response:
def sep(string,n):
return ' '.join([string[i:i n] for i in range(0,len(string),n)])
print(sep('ABCDEFGHIJKLIMNOQRSTUVWXYZ',3))