Python Comprehension Exercises
Let’s say you have a list of words and you want to create a new list that contains the lengths of these words. words = [“apple”, “banana”, “carrot”, “durian”] word_lengths = [] for word in words: word_lengths.append(”) print(word_lengths) # [5, 6, 6, 6] ( word len ) Submit How do you describe this for loop? … Continue reading Python Comprehension Exercises
Copy and paste this URL into your WordPress site to embed
Copy and paste this code into your site to embed