-2
I had done something like this for the even and odd list for the question asks:
- read several words (one by one)
- and concatenate in two (2) texts the words read, as per:
- TEXT 1: All PAR-Sized Words;
- TEXT 2: All Odd-Sized Words;
- Also concatene a hyphen: ?-' between each word of TEXT 1 and 2.
par = []
impar = []
a = ""
b = ""
while True:
print('---MENU---')
print('1- Palavra PAR / 2 - Palavra IMPAR/ 0 - SAIR')
opcao = int(input())
if opcao == 1:
print('Digite uma palavra de tamanho PAR: ')
palavra = (input())
pal = palavra
par.append(palavra)
if opcao == 2:
print('Digite uma palavra de tamanho IMPAR: ')
palavra2 = input()
pa = palavra2
impar.append(palavra2)
if opcao == 0:
break
for i in range(len(par)):
for j in range(i):
for x in par[i][j]:
a = '-'.join(par)
for r in range (len(impar)):
for l in range(r):
for z in par[r][l]:
b ='-'.join(impar)
#printar resultados para usuário:
print(a)
print(b)
But he just imprinted something like
'abcd-acbd' if it has two even words and not: a-b-c-d, a-c-b-d
Could you give examples of what your programme’s inputs will be and what the outputs should be, explaining the context? Only with what you put in the question became impossible to understand the problem. Seek to elaborate a [mcve] to facilitate understanding.
– Woss
I edited, improved?
– Tole