What I did with a Python array

#Initialization
lst = []

for i in range(5):
    #add to
    lst.append(i)
print(lst)  # [0, 1, 2, 3, 4]

#Filter
filtered = list(filter(lambda x:x == 1, lst))
print(filtered)  # [1]

#Count
print(len(filtered))  # 1

Recommended Posts

What I did with a Python array
[Python] What is a with statement?
I made a daemon with Python
What I did to welcome the Python2 EOL with confidence
I made a character counter with Python
I drew a heatmap with seaborn [Python]
I tried a functional language with Python
I made a Hex map with Python
I made a roguelike game with Python
I made a simple blackjack with Python
I made a configuration file with Python
I made a neuron simulator with Python
What I did to save Python memory
A note on what you did to use Flycheck with Python
I made a competitive programming glossary with Python
I made a weather forecast bot-like with Python.
I made a GUI application with Python + PyQt5
[Python] What I did to do Unit Test
I made a Twitter fujoshi blocker with Python ①
I want to make a game with Python
[Python] I made a Youtube Downloader with Tkinter.
What I did when updating from Python 2.6 to 2.7
I want to write to a file with Python
I made a bin picking game with Python
I made a Mattermost bot with Python (+ Flask)
A reminder of what I got stuck when starting Atcoder with python
I tried fp-growth with python
I tried scraping with Python
I learned Python with a beautiful girl at Paiza # 02
I made a Twitter BOT with GAE (python) (with a reference)
I learned Python with a beautiful girl at Paiza # 01
I made blackjack with python!
I tried to draw a route map with Python
I made a net news notification app with Python
What I did when I stumbled on a Django tutorial
What I did when I got stuck in the time limit with lambda python
I made a Python3 environment on Ubuntu with direnv.
Stumble story with Python array
I want to work with a robot in python.
I made a LINE BOT with Python and Heroku
Create a python numpy array
Make a fortune with Python
I tried to automatically generate a password with Python3
[python] Create a date array with arbitrary increments with np.arange
A memo that I touched the Datastore with python
I made a python text
[Python, ObsPy] I wrote a beach ball with Matplotlib + ObsPy
I tried gRPC with Python
I tried scraping with python
I made blackjack with Python.
Create a directory with python
What I learned in Python
What is God? Make a simple chatbot with python
What I did to get started with Linux commands
I made wordcloud with Python.
I want to run a quantum computer with Python
What is a python map?
I replaced the Windows PowerShell cookbook with a python script.
I made a simple typing game with tkinter in Python
I made a package to filter time series with python
I wrote a program quickly to study DI with Python ①