+ 2
What is the difference between first and second codes:
1) words = ["hello", "world", "spam", "eggs"] counter = 0 max_index = len(words ) - 1 while counter <= max_index: word = words[counter] counter = counter + 1 print(word + "!") 2) words = ["hello", "world", "spam", "eggs"] counter = 0 max_index = len(words ) - 1 while counter <= max_index: word = words[counter] print(word + "!") counter = counter + 1
1 ответ
+ 19
There is no difference. Their outputs are equal. The counter variable in the first code shouldn't have an indent by the way.