Last answered:

22 May 2023

Posted on:

06 Apr 2023


questions about code

I have two questions:

1- is the increment i+=1 obligatory in for (I think it's not, but I'm not sure), if not what's the alternative to write within else in this case

2- I don't know why print in the last line does not show the message as I wanted, it put the result before the text

1 answers ( 0 marked as helpful)
Posted on:

22 May 2023


Hi Elmehdi!
Thanks for reaching out.

1) You should use this increment because if the condition is not met, you should go to the next element.

2) This is because you used the print() command in your function. You can use the .append() method and return the list.

Hope this helps.

Submit an answer