Jun-24-2019, 03:51 PM
Your 1st while loop 'while length > 5:' doesn´t stop if length > 5 as there is no
change of length in the loop.
In your 2nd code example the condition 'while len(words_new_list) > 5:' is evaluated
each loop and as you are modifying the words_new_list the len() is different.
change of length in the loop.
In your 2nd code example the condition 'while len(words_new_list) > 5:' is evaluated
each loop and as you are modifying the words_new_list the len() is different.