I'm trying to remove duplicates in a string upon user input. Here''s my code:  userinput = input("Enter a word:") def duplicates_removal(x):       for i in range(len(x)-1):              if x[i] == x[i +1]:                      return duplicates_removal(x.replace(x[i], ' '))       return x   print(duplicates_removal(userInput))   When I run the code, and input the string Bananas,  it produces the output Bananas with the duplicates not removed. Is there any flaws in the code? Also I prefer not using built in functions for this since I just started learning on string manipulation.  Input: Bananas Output desired: Bans
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:
Plot Option Precedence while combining Plots with Show[] Completeness and Incompleteness Through browsing questions asked in the past about Godel's completeness and imcompleteness theorems, I've come to see that the sense of completeness in both of the theorems are different. However, I can't see how they are different!   Does this distinction boil down to that of truth and proof? Is it the case that the completeness theorem talks about the relationship between truth and proof, while the incompleteness theorems only relate to provability?  Could someone please elaborate on the sense in which both notions of completeness are different? GNU screen: Running commands in different window when screen is started When does a gerund become a verb? My question is a follow-up to one in which I identified stealing and killing in a particular sentence as gerunds. Bill J commented to the effect that if objects followed these gerunds, the latter became verbs.   My questions are why and what form of the verb? For me the grammatical distinction between “I dislike killing” and “I dislike killing sheep” is simply that the gerund complement in the first becomes a gerund phrase complement in the second. GRUB doesn't show Windows 10 Whenever I boot into my system, Linux directly boots. If I press shift, GRUB shows only Linux, not Windows. Here are results of fdisk and update-grub. I think I have installed Linux the wrong way.  $ fdisk WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.   Disk /dev/sda: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x00000000     Device Boot      Start         End      Blocks   Id  System /dev/sda1               1  1953525167   976762583+  ee  GPT Partition 1 does not start on physical sector boundary.  $ update-grub Generating grub configuration file ... Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported. Found linux image: /boot/vmlinuz-3.19.0-32-generic Found initrd image: /boot/initrd.img-3.19.0-32-generic Found memtest86+ image: /boot/memtest86+.elf Found memtest86+ image: /boot/memtest86+.bin   No volume groups found done Create a trigger on all the last_modified columns in PostgreSQL In PostgreSQL 9.5, I have tables with columns in the form   prefix_last_modified timestamp without time zone NOT NULL DEFAULT  (clock_timestamp() AT TIME ZONE 'UTC')   I was looking for a way to set the last modified value automatically updated at each update of the rows, and I found  that defined the function:  CREATE OR REPLACE FUNCTION update_modified_column()  RETURNS TRIGGER AS $$ BEGIN     NEW.modified = now();     RETURN NEW;  END; $$ language 'plpgsql';   Now, I'd like to know if there is any way to pass the column name to the PostgreSQL function and to execute it to the NEW row? E.g.  CREATE OR REPLACE FUNCTION update_modified_column(varchar column)        RETURNS TRIGGER AS $$     BEGIN         NEW.column = now();         RETURN NEW;      END; $$ language 'plpgsql'; Given the size of the Empire, it seems highly probable that names would be reused. Although I'm not aware of any in canon, there must be other Skywalkers in the galaxy, leading me to my question.  Are there other Skywalkers in the galaxy, and are they mentioned in canon? Does Luke have any third cousins twice removed (etc.)?  Bonus points if you can attest to force sensitivity among the surname. In many scientific papers, the article before the word "Equation" is omitted. Is there any grammar statement behind this? For instance:     "Equation (8) contains various approximations, and we have to check their consistency." Any way to open windows from the windows bar using a shortcut? for example to open the first window on the left Ctrl+1, to open the second window on the left Ctrl+2.  Im using xfce4 at this moment, but if under xfce4 is not possible, is there any other desktop environment that permits this?  Since I have several windows open for the same application, I not searching for sortcuts related to the application but as I say below, to the window. Book, it follows a guy in a dystopian future What is Chromatic Aberration? What is Chromatic Aberration? Is it a physical part of the lens, or just an optical illusion? Why does evolution not make life longer for humans or any other species?  Wouldn't evolution favour a long life? Primes congruent to 1 mod 6 I came across a claim that I found interesting, but can't seem to prove for some reason. I have the feeling it should be easy  a prime $p$ can be written in the form $p = a^2 -ab +b^2$ for some $a,b\in\mathbb{Z}$ if and only if $p\equiv 1\bmod{6}$ We have a org wide email addressed which has been "Verified" into our sandbox. I understant org wide email addressed is unsupported metadata, so this was achieved as pre deployment step.   Into our repo, we have a workflow that send email alert to that org wide email address. "  Workflow   ... &lt;senderAddress&gt;noreply@mycompany.com.au&lt;/senderAddress&gt; &lt;senderType&gt;OrgWideEmailAddress&lt;/senderType&gt;    The problem we are facing is that we are still getting the following error even if this org wide email address is verified:      You must specify a verified Org Wide Email Address for this sender   type.   Is that a bug in the metadata api or expected behaviour ? Ideally we would like to not have to do that as a post deployment step.   PS: We are running DX under api version 43.0 Flagged emails keep returning and won't synchronize between Apple Mail and Gmail I've had this problem before and can't recall how I managed to fix it last time. I use Apple Mail to access my Gmail and normally flagged emails show up correctly. Starred emails in Gmail equate to flagged emails in Apple Mail and I can unflag an email in either Gmail or Apple Mail and it works.  But now I've got four emails that I can't unflag. They're not flagged in Gmail at all (although they used to be). When I see them in the Flagged folder in Apple Mail, they don't even have flag icons next to them but they're still counted in the number showing next to "Flagged". If I manually re-flag them and then unflag them, they disappear from the Flagged box. But then if I click into Inbox and then back into Flagged they show up again.  Any ideas about how to make these guys disappear for good?! Can you maintain concentration on a spell from another plane? Continuous and preserves measurability $\implies$ preserves null sets. How can I  compare (without calculator or similar device) the values of $\pi^e$ and $e^\pi$ ? how to get full path from fileupload using Javascript What happens to Jen when she jumps off the cliff? What happens to Zhang ziyi (Jen) in  when she jumps off the cliff .. she dies? becomes immortal? Just before jumping what does she want Lo to become - a master?  Why does she jump off, guilt?