Quantcast
Channel: Reconocer palabras en python - Stack Overflow en español
Viewing all articles
Browse latest Browse all 2

Reconocer palabras en python

0
0

estoy trabado en este problema.

Your little brother has just learnt to write one, two and three, in English. He has written a lot of those words in a paper, your task is to recognize them. Note that your little brother is only a child, so he may make small mistakes: for each word, there might be at most one wrong letter. The word length is always correct. It is guaranteed that each letter he wrote is in lower-case, and each word he wrote has a unique interpretation.

Input

The first line contains the number of words that your little brother has written. Each of the following lines contains a single word with all letters in lower-case. The words satisfy the constraints above: at most one letter might be wrong, but the word length is always correct. There will be at most 1000 words in the input.

Output

For each test case, print the numerical value of the word.

introducir la descripción de la imagen aquí

texto=str(input())lista=texto.split()for i in lista:    if len(i)==5:        print("3")    if len(i)==3 and         print("2")    else:        print("1")

Aclaro que soy muy novato estoy usando Python 3.x, lo que quiero saber es si existe alguna funcion que me permita diferenciar las letras porque en el caso del 1 y 2 tienen la misma longitud la palabra. De antemanos gracias!!


Viewing all articles
Browse latest Browse all 2

Latest Images





Latest Images