Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4cb09fa

Browse files
committed
Add solution to new list comprehension exercise
1 parentb498a76 commit4cb09fa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎ch09-lists-tuples-and-dictionaries/2-lists-are-mutable-sequences.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,11 @@
3838
# Exercise 7
3939
# Verify that breakfast has three items using len()
4040
print(len(breakfast)==3)
41+
42+
43+
# Exercise 8
44+
# Create a new list called `lengths` using a list
45+
# comprehension that contains the lengths of each
46+
# string in the `breakfast` list.
47+
lengths= [len(item)foriteminbreakfast]
48+
print(lengths)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp