I tried it with SymPyLive by referring to "[Ruby] Getting unique elements from an array".

(Original post) https://qiita.com/suzu12/items/af0ccbca88f33dec2fda #Practice https://qiita.com/suzu12/items/af0ccbca88f33dec2fda

With SymPy Live

Duplicate elements are extracted from the list in Python, and the list in the list is subtracted in Python. I feel like it will be shorter. Please tell me.

https://live.sympy.org/

sum( [i for i in [1,2,3] if i not in [x for x in set([1,2,3]) if [1,2,3].count(x) > 1]]) 6 sum( [i for i in [3,2,3] if i not in [x for x in set([3,2,3]) if [3,2,3].count(x) > 1]]) 2 sum( [i for i in [3,3,3] if i not in [x for x in set([3,3,3]) if [3,3,3].count(x) > 1]]) 0

Recommended Posts

I tried it with SymPyLive by referring to "[Ruby] Getting unique elements from an array".
I tried to get an image by scraping
I tried to detect an object with M2Det!
I tried to extract a line art from an image with Deep Learning
I tried to implement an artificial perceptron with python
I tried to make an OCR application with PySimpleGUI
I tried to find an alternating series with tensorflow
I tried it with Wolfram Alpha by referring to "Solving simultaneous linear equations with Python (sweeping method and fractional expression)".
I tried using the Python library from Ruby with PyCall
I tried sending an email from Amazon SES with Python
I made a server with Python socket and ssl and tried to access it from a browser
I tried to classify MNIST by GNN (with PyTorch geometric)
I wanted to calculate an array with Sympy's subs method
I tried to predict the sales of game software with VARISTA by referring to the article of Codexa
I tried to create an article in Wiki.js with SQLAlchemy
I tried to make it possible to automatically send an email just by double-clicking the [Python] icon
A memorandum when I tried to get it automatically with selenium
I tried sending an email from the Sakura server with flask-mail
I tried to implement sentence classification by Self Attention with PyTorch
I tried to make an image similarity function with Python + OpenCV
I tried to make it possible to automatically send an email just by double-clicking the [GAS / Python] icon
I tried to refactor the template code posted in "Getting images from Flickr API with Python" (Part 2)
I tried to communicate with a remote server by Socket communication with Python.
I tried to make an open / close sensor (Twitter cooperation) with TWE-Lite-2525A
765 I tried to identify the three professional families by CNN (with Chainer 2.0.0)
I tried to make a calculator with Tkinter so I will write it
Use Python from Java with Jython. I was also addicted to it.
Extract every n elements from an array (list) in Python and Ruby
I tried to learn the angle from sin and cos with chainer
I tried to send a registration completion email from Gmail with django.
[Zaif] I tried to make it easy to trade virtual currencies with Python
I tried to implement Autoencoder with TensorFlow
I tried to get started with Hy
I tried sending an email with python.
I tried to implement CVAE with PyTorch
I tried to solve TSP with QAOA
I tried it with Wolfram Alpha and google, referring to "[Fundamental Information Technology Engineer Examination] I wrote an algorithm for determining leap years in Python."
When I tried to change the root password with ansible, I couldn't access it.
I tried to use Java with Termux using Termux Arch but it didn't work
When I tried to make a VPC with AWS CDK but couldn't make it
I tried to build an environment of Ubuntu 20.04 LTS + ROS2 with Raspberry Pi 4
When I tried to create a virtual environment with Python, it didn't work
I want to write an element to a file with numpy and check it.
I made an image classification model and tried to move it on mobile
[I'm an IT beginner] I tried my best to implement Linux on Windows
I tried to rescue the data of the laptop by booting it on Ubuntu
I tried to create an environment to check regularly using Selenium with AWS Fargate
I tried to pass the G test and E qualification by training from 50
I tried my best to make an optimization function, but it didn't work.
I tried to make a function to retrieve data from database column by column using sql with sqlite3 of python [sqlite3, sql, pandas]
I tried to make it on / off by setting "Create a plug-in that highlights double-byte space with Sublime Text 2".
I tried to predict next year with AI
I tried to program bubble sort by language
I tried to detect Mario with pytorch + yolov3
I tried to implement reading Dataset with PyTorch
I tried to use lightGBM, xgboost with Boruta
I tried to learn logical operations with TF Learn
I tried to move GAN (mnist) with keras
Add rows to an empty array with numpy
I tried to save the data with discord
I tried to detect motion quickly with OpenCV