I would like to create a function that take a list and sum all number in the list. For instance, in the list ["a", 1.50, 2, u'week', 250, 12], the function will return the output 255.50 (1.50 + 2 +250 +12).  def sum(list):    sum = 0    for item in list:       if type(item) == 'a number'          sum += item    return sum   By what could I replace the line if type(item) == 'a number'?
What is the best possible way to check if a string can be represented as a number in Python?   The function I currently have right now is:  def is_number(s):     try:         float(s)         return True     except ValueError:         return False   Which, not only is ugly and slow, seems clunky. However I haven't found a better method because calling float in the main function is even worse.
Tony's Private life in Spider-Man: Homecoming I really don't know how to do this in terms of spoilers, but here goes...  After watching the end of Homecoming, it appears that       Tony and Pepper are very much back together.   Is there any in-universe explanation for this change from the way the universe seemed to be in Civil War? Make apt-get (or aptitude) run with -y but not prompt for replacement of configuration files? When running apt-get -y install &lt;packages ...&gt; on Ubuntu 10.04 I would like apt-get (or aptitude if that makes it easier) to not prompt me when installing additional dependencies (behavior of -y as I understand it) and but not prompt me about overwriting configuration files, instead assume to keep the existing ones always (which is usually the default). Unfortunately --trivial-only seems to be the inverse of -y and not affect the prompt that is shown, according to the man page.  In particular packages auch as samba, nullmailer, localepurge and lighttpd have forced me to interact with the terminal, even though the whole procedure was scripted and meant to be non-interactive. Replace Tag of and xml file after pattern matching using shell I have an input xml file like below INPUT FILE &lt;ReconSummary&gt; &lt;entryName&gt;Total Deep&lt;/entryName&gt; &lt;Code&gt;777&lt;/Code&gt; &lt;License&gt;L&lt;/License&gt; &lt;Tran&gt;H20&lt;/Tran&gt; &lt;job&gt;1234&lt;/job&gt; &lt;/ReconSummary&gt;   &lt;ReconSummary&gt; &lt;entryName&gt;Total Saurav&lt;/entryName&gt; &lt;Code&gt;666&lt;/Code&gt; &lt;License&gt;L&lt;/License&gt; &lt;Tran&gt;H20&lt;/Tran&gt; &lt;job&gt;1234&lt;/job&gt; &lt;/ReconSummary&gt;   &lt;ReconSummary&gt; &lt;entryName&gt;Total Ankur&lt;/entryName&gt; &lt;Code&gt;555&lt;/Code&gt; &lt;License&gt;L&lt;/License&gt; &lt;Tran&gt;H20&lt;/Tran&gt; &lt;job&gt;1234&lt;/job&gt; &lt;/ReconSummary&gt;  I want to comment the tag if i find the pattern &quot;Total Deep&quot; so that the output file looks like below OUTPUT &lt;!--&lt;ReconSummary&gt; &lt;entryName&gt;Total Deep&lt;/entryName&gt; &lt;Code&gt;777&lt;/Code&gt; &lt;License&gt;L&lt;/License&gt; &lt;Tran&gt;H20&lt;/Tran&gt; &lt;job&gt;1234&lt;/job&gt; &lt;/ReconSummary&gt;--&gt;   &lt;ReconSummary&gt; &lt;entryName&gt;Total Saurav&lt;/entryName&gt; &lt;Code&gt;666&lt;/Code&gt; &lt;License&gt;L&lt;/License&gt; &lt;Tran&gt;H20&lt;/Tran&gt; &lt;job&gt;1234&lt;/job&gt; &lt;/ReconSummary&gt;   &lt;ReconSummary&gt; &lt;entryName&gt;Total Ankur&lt;/entryName&gt; &lt;Code&gt;555&lt;/Code&gt; &lt;License&gt;L&lt;/License&gt; &lt;Tran&gt;H20&lt;/Tran&gt; &lt;job&gt;1234&lt;/job&gt; &lt;/ReconSummary&gt;  Since i am new to shell scripting, can anyone help me out as to how i can apply this with the help of shell scripting? I want to learn more about hopf algebras but I am having trouble finding a down to earth introduction to the subject with lots of motivation and examples. My algebra knowledge ranges from Dummit and Foote, Atiyah-Macdonald commutative algebra, and Hartshorne level algebraic geometry.  What are good places to look at for a hopf algebra beginner? My main motivation is for studying groupoid schemes from an algebraic point of view. Find the value of $\int_{-\infty}^{\infty} \frac{e^{-x^2}}{1+x^2} dx$ . Find the value of $\int_{-\infty}^{\infty} \frac{e^{-x^2}}{1+x^2} dx$     My attempt  First, I know the existence of this integral since $$ \mid \int_{-a}^{a} \frac{e^{-x^2}}{1+x^2} dx \mid \;\; \leq\;\;  \mid \int_{-a}^{a} \frac{1}{1+x^2} dx \mid$$  Next, let $R &gt;0 $ be an arbitrary and $\gamma_1(t) = -R(1-t) + Rt , \;\; 0 \leq t \leq1$ and $\gamma_2(t)= Re^{i\pi (t-1)}, \;\; 1 \leq t \leq 2 $.  So, take $f(z) = \frac{e^{-z^2}}{1+z^2}$.   I tried to find the value or upper bound of norm of $$\int_{\gamma_2} \frac{e^{-z^2}}{1+z^2} dz$$.  However, $$ \lvert\int_{\gamma_2} \frac{e^{-z^2}}{1+z^2} dz\rvert \leq  \frac{\text{max}\lvert e^{-z^2}\rvert}{R^2-1}\pi R = \frac{e^{R^2}}{R^2-1}\pi R $$ So, I can't proceed this.  May I ask you how to solve this? Dell R730xd - Best way to configure storage for simultaneous use with ZFS & Hardware RAID I recently purchased a Dell R730xd that came with an H730 RAID card. I would like to bring an existing 6 disk ZFS pool to this server as well as create an additional 6 disk hardware RAID.   Is it possible to configure an H730 RAID card to operate in both HBA and RAID mode simultaneously? And then only manage 6 of the disks in a hardware RAID and allow the OS to manage the remaining 6 disks in a software RAID?  If not, can a Dell R730xd use both an H730 RAID card and an LSI 9207-8i HBA card simultaneously? Would you simply plug one SAS cable from each card into each part of the Backplane? Will I need to purchase any new cables to connect the LSI 9207-8i to the backplane in my R730xd?  Is there a better card to use for ZFS in an R730xd using spinning disks than the LSI 9207-8i? postfix fails to send mail with "fatal: unknown service: smtp/tcp" Evaluating $\int_0^{\infty}\frac{\ln(x^2+1)}{x^2+1}dx$ How would I go about evaluating this integral? $$\int_0^{\infty}\frac{\ln(x^2+1)}{x^2+1}dx.$$ What I've tried so far: I tried a semicircular integral in the positive imaginary part of the complex plane, excluding the negative real axis, but had trouble calculating the residue at $z=i$ (perhaps there is a way of doing this that I don't know of). After that didn't work, I tried a rectangular box integral from $\epsilon$ to $R$, from $R$ to $R+i/2$, from $R+i/2$ to $-S+i/2$, from $-S+i/2$ to $-S+i\epsilon$, from $-S+i\epsilon$ to $-\epsilon+i\epsilon$ and finally a semicircle around the origin, radius $\epsilon$.   Any help would be appreciated. Scenario  I created a journey with a Contact Data entry event that is triggered via the API. A subscriber should be able to be injected multiple times and the values in the data extension are updated while the subscriber is in the journey. The updated values should determine the path the subscriber follows.  Setup  As changed data needs to be evaluated and the contactkey cannot be used as primary key, I added a random id as primary key and created an attribute group for the data extension in Data Designer. The data extension is linked to the contact's contactkey using a one-to-many relationship as a contact should be able to enter the journey multiple times.  In the journey I'm using a decision split that is configured to use contact data from the created attribute group and has two branches (as it checks a boolean value).  Problem  For multiple entries the decision split doesn't evaluate correctly and always leads to same branch (value equals false). I suppose the problem is that journey builder doesn't use the primary key to identify the correct row in the data extension. Is there any way to make sure the row is matched using this id and not the contactkey as this leads to some strange behaviour as described here: Inheriting constructors Why does this code:  class A {     public:          explicit A(int x) {} };  class B: public A { };  int main(void) {     B *b = new B(5);     delete b; }   Result in these errors:   main.cpp: In function ‘int main()’: main.cpp:13: error: no matching function for call to ‘B::B(int)’ main.cpp:8: note: candidates are: B::B() main.cpp:8: note:                 B::B(const B&)   Shouldn't B inherit A's constructor?  (this is using gcc) How should duplicate questions be handled? What should I do when I see a question that is a duplicate of another one?   Should I answer it? Should I downvote it? Should I comment? Should I edit the question to indicate it's a duplicate? If I can, should I (vote to) close the question? What happens when I vote to close as duplicate? Or: Why did a comment with my name on it just appear? Should I flag it for moderator attention? What about similar or related questions? Proof of lack of pure prime producing polynomials. I recently encountered this following proposition:  For every polynomial, there is some positive integer for which it is composite.  What is the most elementary proof of this? How to export a individual layer with a fixed master layer in Photoshop? Let's say I have some layers and a single different one, or a group of layers I want to export merged together, in a way that every single exported layer is merged with a specific layer or group of layers.  In the example below I have some layers which need to be exported into JPG or PNG, merged with the very top layer called "Blurred". In my case, I want to export the layers (Jan 8 + Blurred) and (Layer 10 + Blurred) and so on. Acting as exporting layers merged with a master layer called "Blurred".  My question in a simple way: how to apply a Master layer(s)/Group(s) in Photoshop to be exported with every layer I have? MySQL string replace How to read value of variable, where the name of variable is the value of another variable Custom Post Type Archives by Year & Month? How do you display the archives of a Custom Post Type by Year &amp; Month? Evaluating $\int_0^{2 \pi} e^{\cos x} \cos (nx - \sin x) \,dx$ using complex analysis I'm taking a complex analysis course and doing some practice computing residues &amp; evaluating integrals. I pulled out an old book called     On page 196-197, there are some interesting integrals to evaluate. I'm at 5.4.3.10.: I was able to do question 1, but was stumped at how to even begin with question 2:     Evaluate the integral   $$\int_0^{2 \pi} e^{\cos x} \cos (nx - \sin x) \,dx ,$$   where $n$ is an natural number.   The answer is simply $\frac{2 \pi}{n}$. Any hints? Is there a gender-neutral word for "aunts and uncles"/"parents' siblings"? Within 300 km of Tokyo: Where for flora, landscape, nature? The book says:     Concentration. Some spells require you to maintain concentration in order to keep   their magic active. If you lose concentration, such a spell ends.   So what happens if, for example, you are already concentrating on a spell, and cast Witch Bolt without concentrating. Would you get the initial arc of blue energy, or would it not even go off?  I am asking if you can cast a spell that says concentration without concentrating for an immediate effect. This would be useful to avoid interrupting your existing concentration. In essence, if you are concentrating on thing A (doesn't have to be a spell since other things need concentration), can you cast a concentration spell getting an immediate effect without losing concentration on thing A?  Since the definition of concentration is to keep the spell active (meaning it is already active) I would think that you would get the initial effect (if it had one) without the need to concentrate on it.