Why for example when slicing a list with square brackets in this way  spam = [1, 2, 3]   When we print(spam[0:2]) the 3 is not typed while the index of that is 2?
I need a good explanation (references are a plus) on Python's slice notation.   To me, this notation needs a bit of picking up.   It looks extremely powerful, but I haven't quite got my head around it.
How can I re-write the conditionals for this button I've been trying out React for a couple of days and I tried to build a button component with some conditionals. Everything works but I feel like I am not doing it the right way. Could anyone review my code and give me some advice and tell me what I am doing wrong or what i could do better. I think I am using too many return statements. I use Typescript for type checking. Would appreciate any help! import { Link } from &quot;gatsby&quot;;  interface Props {   content: string,   color: string,   path?: string,   type?: string }  export default function Button(props: Props): JSX.Element {   let elementType;    const checkProps = () =&gt; {     const availableColors = ['blue', 'grey', 'dark-grey', 'white'];     const borderColors = [''];     let buttonStyle;      // Check if props.color exists in availableColors     if(!availableColors.includes(props.color)) {       console.error(`&quot;${props.color} color key not available for button style`);       return;     }          buttonStyle = buttonStyles[`button--${props.color}`];      // Check if props.content is valid     if(!props.content) {       console.error(`&quot;${props.content} is not valid as content`);       return;     }      // Check if props.type exists     if(!props.type) {       elementType = &lt;button className={ buttonStyle }&gt;{ props.content }&lt;/button&gt;       return;     }      if(props.type !== 'link') {       console.error(`&quot;${props.type} is not a valid type, use 'link' instead or use nothing for default button`);       return;     } else {         elementType = &lt;Link to={ props.path } className={ buttonStyle }&gt;{ props.content }&lt;/Link&gt;     }   }    checkProps();    return (     &lt;React.Fragment&gt;       { elementType }     &lt;/React.Fragment&gt;   ); }``` Configuring dpkg stops processing when calling an HTTP request to Adobe Flash Player How do I get the path of the directory in which a  script is located, inside that script? I want to use a Bash script as a launcher for another application. I want to change the working directory to the one where the Bash script is located, so I can operate on the files in that directory, like so: $ ./application In ZF set theory the axiom of regularity (also called axiom of foundation) says that:     In all nonempty sets x there is an element y such that x∩y=∅   As I been told that  of the axiom is to prohibit constructions as $x\in x$, but is this a possible strategy?  Given a binary predicate $R$, written in infix notation, there are unitary predicates $p$ such that:  $\qquad \exists y \forall x: x R y \leftrightarrow p(x)$.  But there also are some convincing counterexamples:   $  p(x) \leftrightarrow \neg(x R x)$ $  p(x) \leftrightarrow \neg(x R f(x))$, where $f$ is any surjection $  p(x) \leftrightarrow$ all chains $x_1 R x, \: x_2 R x_1, \: x_3 R x_2,  \ldots \:$ are finite.   I think there is a major mistake to try to avoid certain paradoxical loops. First, there are no guarantees that every possibility is prohibited. And second, it seems pathological to make constructions that avoid certain proof-techniques (it's like the attitude of a shyster).  So, what protection comes from this axiom? Historically, has it anything to do with the Russell-predicate $x\notin x$?  See also I have often heard people say "x of his" or "x of mine". But since his and mine point out ownership, isn't using "of" here doubles that ownership? Wouldn't it be more appropriate to say "x of him" or "x of them" etc.?  Example:     I was a good friend of your dad's. He told me all about you` What is the meaning of "this" in Java? Can an abstract class have a constructor? Can an abstract class have a constructor?  If so, how can it be used and for what purposes? Is there a way to recover deleted data from a SSD / USB Flash drive?  All I could find were recovery for damaged drives, but I want to recover deleted data.  So how do I do this? What is the best way to identify outliers in multivariate data? Suppose I have a large set of multivariate data with at least three variables. How can I find the outliers? Pairwise scatterplots won't work as it is possible for an outlier to exist in 3 dimensions that is not an outlier in any of the 2 dimensional subspaces.  I am not thinking of a regression problem, but of true multivariate data. So answers involving robust regression or computing leverage are not helpful.  One possibility would be to compute the principal component scores and look for an outlier in the bivariate scatterplot of the first two scores. Would that be guaranteed to work? Are there better approaches? How does Router know where to forward packet If several computers with local addresses (192.168.0.#) are connected to a router and each computer opens a web browser and requests a page over HTTP, when these TCP:80 packets are sent out, the router switches the local address with the static IP of the router (i.e. Provider given IP) so the server can reply to the appropriate address.   But how does the router know to which computer to forward the HTTP reply, since the TCP header does not contain the local IP address (does it?), and all computers are using port 80?  Does this have anything to do with the MAC addresses?   How exactly does this work? How to Expand , Resize "extended partition"? How can I expand/resize my extended partition (sda3) with unallocated free space to the left of it? I want this to be able to expand my / partition (sda5). Is it possible to construct an (asymmetric) encryption scheme from a signature scheme?  If the signature scheme is deterministic and allows  (e.g. ), then the answer is yes (create a forgery (m, sig); encrypt plaintexts using  with sig as the key; send m in clear to the signer along with ciphertexts, who can then compute sig and decrypt these ciphertexts) .  I am interested in similar reductions for probabilistic signature schemes.  What should the properties of a probabilistic signature scheme be so that it can be used for encryption? What is the variance of Y = AX where A is a matrix? Here $X,Y$ are vector of length $n$ and $A$ is  a $n\times n$ matrix. Suppose the covariance matrix $D(X)$ is known? How to wipe and install ubuntu? Can you help me with my capacity planning? Verb/Subject Agreement Make/Makes Is there a term for words that when reversed, form other words? I'm aware of what a palindrome is. What do you call words that, when reversed, form other words, such as ton (not) and part (trap)? How is the equation of motion on an ellipse derived? I would like to show that a particle orbiting another will follow the trajectory   \begin{equation} r = \frac{a(1-e^2)}{1 + e \cos(\theta)}. \end{equation}  I would like to do this with minimal assumptions. Any pointers? I've read that this is nothing but the equation for an ellipse, as defined from the focus of the ellipse. But I'm not satisfied in just taking the result, I mean why should I assume that orbits are elliptical? I guess it should be derivable from energy and angular momentum considerations... Is there a quick way to get to the Control Panel in Windows 8? Obviously in all previous versions of Windows you could simply click START and then select "Control Panel" to get to it, but on Windows 8 there is no such option.  Is there an easy way to quickly get to it without having to press WIN, type "Control Panel", and then press Enter? My processor is using a big part of my RAM memory as cache and I want to clean it up because of that; will it prejudice something?