Професионална програма
Loading...
Zapryan avatar Zapryan 5 Точки

Задача Contact List

Здравейте, колеги! Не мога да разбера къде греша в следната задача:

Create a program that helps you keep track of the contacts that you have. You will receive the list of contacts you already have on a single line, separated by a single space in the following format:
"{contact1} {contact2} {contact3}… {contactn}"
Then you will receive commands that you need to execute over your list. There are four possible commands:
"Add {contact} {index}":
If {contact} isn’t already contained – add it in the end of the collection.
If {contact} is already contained – add it on the given index, if the index exists.
"Remove {index}"
Remove the contact on the given index, if the index exists.
"Export {startIndex} {count}":
Print the next {count} contacts starting from the given {startIndex} (including), separated by a single space. If the count requested is more than the contacts- just print them to the end.
"{contact} {contact} {contact}"
"Print Normal/Reversed"
Print the contact list in normal (in the order they have been added) or reversed order and then stop the program:
"Contacts: {contact1} {contact2}… {contactn}"
Input
On the 1st line, you will receive the starting list with the names of the contacts separated by a single space.
On the next lines, you will receive commands in the format described above.
Output
Print the needed output upon the "Export" command.
Print the list after the manipulations upon the "Print" command in the format described above.


В Judge получавам 90 точки.

Моят код е: https://pastebin.com/r84LJb8N

Линк към Judge: https://judge.softuni.bg/Contests/Practice/Index/1682#2

Тагове:
0
Python Fundamentals
Rafaelo avatar Rafaelo 42 Точки

Здравей,

Дали си успял случайно да откриеш проблема? Имам абсолютно същата ситуация и предполагам нещо с Export action-a e но не го проумявам. Ето и моя код за референция:

https://pastebin.com/HVqcwutQ

0
Zapryan avatar Zapryan 5 Точки

Здравей! Всъщност аз тази задача я бях забравил, че не съм успял да я докарам до 100 точки и твоят въпрос ме подсети да я погледна пак и пак да се опитам. В крайна сметка успях и наистина проблемът при мен беше в export командата. Заповядай код, който дава 100 точки: https://pastebin.com/7gRDeJvu

1