HI there!
I was a skilled programmer that didn’t program high-Level languages for ages.
Today I tried to program the exercise above and was not capable of solving it
Below code is for testing the removeItemAtBottom function in Elyses Enchantments problem. But, It’s seems to be not working expectedly. Because Task 5, remove_item_from_top!(stack)
and Task 7, remove_item_at_bottom!(stack) are not working
In the beginning I was not shure what top or bottom in the example was, as the uppermost card in the hand seems to be bottom and the one next to the palm seems to be first after some thaughts about that (and test runs).
it worked neither with (the hint-section suggests this:)
function remove_item_at_bottom!(stack)
popfirst!(stack)
end
function remove_item_from_top!(stack)
pop!(stack)
end
ERROR:
Code Run
Test Failed
Expression: remove_item_from_top!(stack) ==
Evaluated: 1 == Any
Test Failure
Test Failed at ./runtests.jl:107
Expression: remove_item_from_top!(stack) ==
Evaluated: 1 == Any
(according output in remove_item_at_bottom!(stack))
nor with
function remove_item_at_bottom!(stack)
pop!(stack)
end
function remove_item_from_top!(stack)
popfirst!(stack)
end
ERROR:
Test Failed
Expression: remove_item_from_top!(stack) ==
Evaluated: 1 == Any
could there be a mistake or did I get something completely wrong?
I also found this discussion and
for me it looks as if the reference is done by reference (where the original is modified)
Code issue
stack = [3, 2, 6, 4, 8];
remove_item_from_top!(stack)
thanks for answers in advance
Hubert