I have a list and don't know all the values but I want to remove all the values which occurs more than once and only one of that value is left.Suppose here is the list:  lst = ['one', 'two', 'three', 'four','four','five','five','five']   This is what I need:  lst = ['one', 'two', 'three', 'four','five']   Here is what I have tried:  i=0 for ele in lst: if ele[i] in lst:     lst.remove(ele[i])   but it's not working.
Is there a built-in that removes duplicates from list in Python, whilst preserving order? I know that I can use a set to remove duplicates, but that destroys the original order. I also know that I can roll my own like this:  def uniq(input):   output = []   for x in input:     if x not in output:       output.append(x)   return output   (Thanks to  for that .)  But I'd like to avail myself of a built-in or a more Pythonic idiom if possible.  Related question:
"elements required by agent" is "required" here an adjective or verb? "elements required by agent" is "required" here an adjective or verb?  another example "elements expressed by person". I have a query where I chain two columns. Why does the alias not work in the GROUP BY clause but in ORDER BY clause, it does work? How can I write the select correctly?  SELECT   KOS_VER_ID        AS "Vertrag"   , WHR_ISO_3_CODE  AS "Waehrung"   , KOS_KOA_ST_KZN || '  -  ' || ST_LANGBEZ_EN as "Kostenart"   , SUM (KOS_BETRAG) AS "Summe pro KOA" FROM   KOSTEN   , WAEHRUNG   , SCHLUESSELTABELLE WHERE    KOSTEN.KOS_VERHI_WHR_ID = WAEHRUNG.WHR_ISO_ID   AND KOSTEN.KOS_KOA_ST_KZN = SCHLUESSELTABELLE.ST_ID   AND KOS_VER_ID in (2509, 2510, 2511) GROUP BY   KOS_VER_ID   , WHR_ISO_3_CODE   , KOS_KOA_ST_KZN || '  -  ' || ST_LANGBEZ_EN ORDER BY   "Vertrag"   , "Kostenart" ; Passcode is required to enable Touch ID This morning I experienced the weirdest thing by my iPhone 6S requiring me to enter my passcode rather than allowing me to use my finger as Touch ID.  My phone was locked probably for like 4 hours while charging overnight and as far as my knowledge my phone did not restart during this time since my Stack Exchange app was left open and upon opening it the same content were still there.  I didn't attempt even once to use my Touch ID; if I would've had a faulty Touch ID sensor then I should've seen such similar behavior either prior to this morning or at least afterwards (I'm already on my phone for the past 3 hours plus).  I didn't register or delete any fingerprints for months.  And finally, I don't have any restrictions setup to require the input of my passcode under Settings > General > Restrictions.  I'm running on iOS Version 10.0 beta 3 (14A5309d)  Anyone out there that has also experienced such similar behavior or with any suggestion on what might've caused it? How to Achieve this Requirement ???Can i use Jave Script , CSS and Visual force page? If $n\ne 4$ is composite, then $n$ divides $(n-1)!$. I have a proof and need some feedback. It seems really obvious that the statement is true but it is always the obvious ones that are a little trickier to prove. So I would appreciate any feedback. Thank you!  Here is what I am asked to prove:     If $n$ is composite then $(n-1)! \equiv 0 \pmod n$.   Proof:  $n$ is composite $\implies n=ab$ where $a,b \in \mathbb{Z}$ and $0&lt;a,b&lt;n$.  Case 1: If $a=b$ then $n=a^{2}$. Now $n \mid (n-1)! \implies a \mid (n-1)!$, so $$\begin{aligned} (n-1)! &amp;\equiv 1\times 2\times \dotsb \times a \times\dotsb\times (n-a)\times\dotsb\times (n-1) \\ &amp;\equiv 1\times 2\times \dotsb\times a \times\dotsb\times -a\times\dotsb\times -1 \\ &amp;\equiv 0 \pmod n \end{aligned}$$  Case 2: $0&lt;a&lt;b&lt;n$.  Then, since $a \mid n$, $b \mid n$ and $n \mid (n-1)!$ we have that $a \mid (n-1)!$ and $b \mid (n-1)!$.  So this implies $(n-1)! \equiv 1\times 2\times \dotsb\times a \times\dotsb\times b\times\dotsb\times (n-1) \equiv 0 \pmod n$, Q.E.D. Show that $a^{61} \equiv a\pmod{1001}$ for every $a \in \mathbb{N}$ Suspend broken on Ubuntu 16.04 LTS, Dell XPS 9350 Since I upgraded from Ubuntu 15.10 to Ubuntu 16.04 LTS on my Dell XPS 9350, suspend is broken. When closing my lid the laptop will suspend, but resuming fails and it reboots. I tried pm-suspend and tried resuming, resuming failed and the laptop rebooted. I got the following errors when I got back into Ubuntu. The odd thing in my opinion is that it claims the kernel is not an official ubuntu package. Either way my Linux knowledge is not sufficient to know what's going wrong here.      EDIT: I just tried installing kernel 4.4.8 which should fix some things, but it did not fix this problem. By now I also tried 4.4.9 and 4.6 RC7. None of them fixed it for me. My question is, how would I make the visible HDRI/Enviroment Map be image 1 and then have reflections as Image 2? If someone can post a node setup, or a .py file that would be great &lt;3 I was thinking maybe using the Is Camera Ray node but I'm not confident it would work, and have no idea where to start. Can TikZ create pixel art images? Can you create images like this:    when you have something like  0 = green (#54ff00) 1 = white (#ffffff) 2 = red   (#ff0000) 3 = blue  (#0048ff)  Image (Python list of integers defined above): [[2,0,0,0,0,0,0],  [0,3,0,0,0,0,0],  [0,3,2,1,1,0,0],  [0,3,2,2,2,1,1],  [0,3,2,0,0,1,0],  [0,0,0,0,0,1,0],  [0,0,0,0,0,1,0]]   with TikZ?  How far I got  The following MWE defines all colors, produces a grid of the correct size (though the size is determined by hand):  \documentclass[varwidth=true, border=2pt]{standalone} \usepackage{tikz} \usepackage{xcolor}  \begin{document}     \newcommand\n{7}     \definecolor{green}{HTML}{54FF00}     \definecolor{wite}{HTML}{FFFFFF}     \definecolor{red}{HTML}{FF0000}     \definecolor{blue}{HTML}{0048FF}     \begin{tikzpicture}         \foreach \x in {1,...,\n}{             \foreach \y in {1,...,\n}{                 \begin{scope}[shift={(\x,\y)}]                   \draw [fill=green] (0,0) rectangle (1,1);                 \end{scope}             }         }     \end{tikzpicture} \end{document}   Of course, I could simpy make a lot of adjusted                   \begin{scope}[shift={(\x,\y)}]                   \draw [fill=green] (0,0) rectangle (1,1);                 \end{scope}   but I've wondered if this can (with reasonable effort) be done in TikZ / LaTeX.  My problem is giving TikZ the color array. I don't have any idea how to do this. I only know two types of looks in TikZ:  \foreach \x in {0,1,2,3,4,5}{...} \foreach \number in {1,...,\n}{...}   I have never seen a nested over a 2D-array. All I have seen so far were 1D-Arrays of tuples (with fixed tuple size). Permanent Redirect (WWW to non WWW) Will Unity allow making custom launcher icons from .desktop files or via menu editing system? (Right now the launcher doesn't give the option to "keep in launcher" on all programs.  For some programs I use, I have to make custom launchers or .desktop files.  For instance, daily blender builds are generally just folders with an executable.  In basic Gnome or KDE, I can make a new menu entry with the menu editing system. Then, I can also add it to Docky either from the menu or by dragging a .desktop file to it. Unity launcher doesn't support drag and drop, so thats not a bug or anything, but when I open a .desktop file, it has unpredictable results. Most time it will not have "keep in launcher". Sometime it will have a pinnable item without the .desktop's icon, and if I pin the item to the launcher, it will not call upon the program again after closing it. I've also gotten it to just work with a .desktop file for celtx. Is it possible to make a sequence of renders and give the user the option to cancel the process through the UI at any given time? How to help a toddler overcome the fear of water on head? Real numbers equipped with the metric $ d (x,y) = | \arctan(x) - \arctan(y)| $ is an incomplete metric space I have to show that the real numbers equipped with the metric $ d (x,y) = | \arctan(x) - \arctan(y)| $ is an incomplete metric space.  Certainly, I have to search for a Cauchy sequence of real numbers with respect to given metric that must not be convergent. But I am unable to figure out that.  Can anybody help me with this.   Thanks for helping me. The ability to undo reviews Using all the letters of the word ARRANGEMENT how many different words using all letters at a time can be made such that both A, both E, both R both N occur together . Command to perform a recursive chmod to make all .sh files within a directory executable? When do you use Quantum Mechanics? Given a problem, how does one know whether to use quantum mechanics or classical mechanics?   Take for example electron scattering from a nucleus. The electrons are given a wavefunction in this case. Why not use the classical approach? Send an email as an attachment from iPhone Is it true that if $A$ is a nonnegative primitive matrix, then $AA^T$ is also primitive? Obviously $A^T$ is primitive but in general product of primitive matrices is not primitive.  Any hint?