satu baris untuk loop python
[thing for thing in list_of_things]
Tremendous Enceladus
[thing for thing in list_of_things]
mylist = [1,4,5,8,9,11,13,12]
newlist = [x for x in mylist if x%2 == 1]
print(newlist)
>>> x = [1, 2, 3, 4, 5]
>>> y = [2*a for a in x if a % 2 == 1]
>>> print(y)
[2, 6, 10]
>>> [(i) for i in my_list if i=="two"]
['two']
print(stripped_line)