Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Notice Board

Per partecipare al corso di Fondamenti di programmazione 2023-24 loggatevi e attivatelo nella vostra pagina dei corsi preferiti. A quel punto il corso appare nel menù personale cliccando sul proprio avatar. Per i materiali degli anni precedenti seguite lo stesso metodo.

To join the Programming/Lab 2023-24 course, log-on and select it on the my courses page. It will appear on the personal menu of your avatar. For earlier years use the same method.

[HW4] multiple words in the same row of the file, and strange characters

e
enricomaria.follega (1460 points)
9 18 29
in HW4 by (1.5k points)
closed by
I had a look at the HW4.

For most of the tests, inside each file i saw only 1 word for row, whereas in the last ones there are multiple words for each row.

How should the code behave in these cases?

It should consider everything just like a big string without spaces?

About the kanji, the emojis and the strange characters (how are they called, look alike runes or something) instead.

We consider each character as a word, right? We are not supposed to take the ord() of it.

Thks
318 views
closed

1 Answer

Best answer
c
charlieHeron (1380 points)
7 19 26
by (1.4k points)
selected by
If there are multiple words on one line split by spaces or tabs, you need to split the line up into different words. When there is a series of unusual characters, they should be considered a single word unless split by a tab, space or new line.
e
enricomaria.follega (1460 points)
9 18 29
by (1.5k points)
so split each word on the same row and we should consider the first letter of the second word as p(0) position?

thus to say that we consider just like a word in a new line?
Taiel26 (1570 points)
3 6 16
by (1.6k points)
"strings separated by spaces, tabs, or carriage return characters." basically anything that can be separated just using split() should be considered a new word.