7. List Manipulation Advanced
Привет,
правя задача 7 -ма от Листове - Лаб .
Докарах я до 50/100. Бъгва ми се при печатането. Изкарвам нужните данни, но забелязвам, че при подаване на condition filter , при вторият такъв , той се печата на същият ред , а при end, ми печата отново входа след командата. Прилагам кода , заедно с условието на задачата и аутпута ми от джъдж.
https://pastebin.com/WCp9UShK?fbclid=IwAR2NuFb4QEQYaP4Hg3-IR4zEUb-kwP_fYz8JKWGIu9SOxWoCOUZxvVj0_E0
Next, we are going to implement more complicated list commands, extending the previous task. Again, read a list and keep reading commands until you receive "end":
Contains {number} – check if the list contains the number and if so - print "Yes", otherwise print "No such number".
PrintEven – print all the even numbers, separated by a space.
PrintOdd – print all the odd numbers, separated by a space.
GetSum – print the sum of all the numbers.
Filter {condition} {number} – print all the numbers that fulfill the given condition. The condition will be either '<', '>', ">=", "<=".
After the end command, print the list only if you have made some changes to the original list. Changes are made only from the commands from the previous task.
Example
| Input | Output | 
| 2 13 43 876 342 23 543 Contains 100 Contains 543 PrintEven PrintOdd GetSum Filter >= 43 Filter < 100 end | 
 No such number Yes 2 876 342 13 43 23 543 1842 43 876 342 543 2 13 43 23 
 | 
Това ми е output-a
2 13 43 876 342 23 543
Contains 100
No such number
Contains 543
Yes
PrintEven
2 876 342
PrintOdd
13 43 23 543
GetSum
1842
Filter >= 43
43 876 342 543 Filter < 100
2 13 43 23 end
2 13 43 876 342 23 543
Благодаря ти, отново! Получи се, бях пропуснал варианта от условието, когато има промяна.