python内包表記
a = []
for x in range(1, 5):
a.append(x ** 2)
print(a)
は
a = [x ** 2 for x in range(1,5)]
print(a)
と書くことができる
Go to list of users who liked
More than 3 years have passed since last update.
python内包表記
a = []
for x in range(1, 5):
a.append(x ** 2)
print(a)
は
a = [x ** 2 for x in range(1,5)]
print(a)
と書くことができる
Register as a new user and use Qiita more conveniently
Go to list of users who liked