get_list_of_countries_whose_nth_letter_is(3, “m”) would return a list of every country whose THIRD letter (i.e. index 2) is the letter m: ['Armenia', 'Cambodia', 'Cameroon', 'Comoros', 'Dominica', 'Dominican Republic', 'Gambia', 'Jamaica', 'Namibia', 'Romania', 'Samoa', 'Somalia', 'Yemen', 'Zambia', 'Zimbabwe']  Note: you MUST use a for loop. This is what I have I know it is just printing letters with &quot;M&quot; but If I could get some input into printing out country whose THIRD letter (i.e. index 2) is the letter m. def get_list_of_countries_whose_nth_letter_is(n_letter):     countrie = []     for countries1 in countries:         if &quot;M&quot; in countries1.upper():             countrie.append(countries1)     print(countrie)  ['Armenia', 'Bahamas', 'Belgium', 'Cambodia', 'Cameroon', 'Colombia', 'Comoros', 'Congo, Democratic Republic of the', 'Denmark', 'Dominica', 'Dominican Republic', 'East Timor', 'Federated States of Micronesia', 'Gambia', 'Germany', 'Guatemala', 'Jamaica', 'Luxembourg', 'Madagascar', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands', 'Mauritania', 'Mauritius', 'Mexico', 'Moldova', 'Monaco', 'Mongolia', 'Montenegro', 'Morocco', 'Mozambique', 'Myanmar (Burma)', 'Namibia', 'North Macedonia (Macedonia)', 'Oman', 'Panama', 'Romania', 'Samoa', 'San Marino', 'Sao Tome and Principe', 'Solomon Islands', 'Somalia', 'Suriname', 'Turkmenistan', 'United Arab Emirates', 'United Kingdom', 'Vietnam', 'Yemen', 'Zambia', 'Zimbabwe']
50285
Is there a way to substring a string in Python, to get a new string from the third character to the end of the string?  Maybe like myString[2:end]?  If leaving the second part means 'till the end', and if you leave the first part, does it start from the start?
57185
I want to split a character string n by n. I know how to do that 1 by 1 :  \documentclass{article} \makeatletter  \def\s@plit&lt;#1#2&gt;{%   \ifx\empty#2%     #1%   \else     #1,\s@plit&lt;#2&gt;%   \fi}  \def\Split#1#2{\s@plit&lt;#2\empty&gt;} \makeatother  \begin{document} \Split{1}{123456789} \end{document}   It gives : 1,2,3,4,5,6,7,8,9  But I also want 1,23,45,67,89 or 123,456,789 ... depending from the first parameter.  EDIT  Work straight and reverse, even with foreach.        \documentclass{article}     \usepackage{tikz,xparse,xstring}  \DeclareDocumentCommand{\split}{smmo}{%     \xdef\Entree{#3}%     \let\Sortie\empty%     \IfBooleanTF #1     {% sans étoile         \loop         \StrRight{\Entree}{#2}[\tmp]%         \edef\Sortie{\Sortie,\tmp}%         \StrGobbleRight{\Entree}{#2}[\Entree]%         \unless\ifx\Entree\empty         \repeat         \StrGobbleLeft{\Sortie}{1}[\Sortie]%     }     {% avec étoile dans l'ordre inverse         \loop         \StrRight{\Entree}{#2}[\tmp]%         \edef\Sortie{\tmp,\Sortie}%         \StrGobbleRight{\Entree}{#2}[\Entree]%         \unless\ifx\Entree\empty         \repeat         \StrGobbleRight{\Sortie}{1}[\Sortie]%     }     \IfNoValueTF{#4}{\Sortie}{\edef#4{\Sortie}}     }  \begin{document} \split{2}{6513782}  \split*{2}{6513782}  \split*{2}{6513782}[\bob]  \foreach \x in \bob {[\x] }  \end{document}
76762
I have written a Python 3 code, which is:  i = int(input("enter number: ")) print("enter",i)   I'm expecting an output as:  enter number: 5 enter 5   However, I'm getting this:  enter number: 5 ('enter', 5)   What could be the issue? How can I rectify this?
77862
I have a menu that let's a user select a country. Exactly like that in the contacts.app country menu within the address field.   Does anyone know a simple way of getting a list of countries? I have used NSLocale to generate an array of countries but it's only the country codes unfortunately and not the human readable equivalent. I don't want 'GB' I want Great Britain.
41538
What is the number of ways to select ten distinct letters from the alphabet $\{a, b, c, \ldots, z\}$, if no two consecutive letters can be selected?   There are a couple of formulas that I could use, but I am not sure how to use them.     The number of combinations of a given length that use elements from a given set, allowing repetition and with no missing elements in other words, each element of the given set occurs at least once in each combination: $\binom{k-1}{n-1}$ where where $n$ is the number of elements in the given set and $k$ is the length of the combination.   OR     The number of combinations of a given length that use elements from a given set, allowing repetition: $\binom{n+k-1}{n-1}=\binom{n+k-1}{k}$ where $n$ is number of elements in the given set and $k$ is the length of the combination.   Please help me understand what I should do and how to go about solving this question?
55508
I would like to find out the number of occurrences of each of the alphabets in a word. Eg  input  aabbbddd    output  a@2 b@3 c@0 d@3   How can I perform this using shell script?
26213
I can't seem to find an answer to this problem, and I'm wondering if one exists. Simplified example:  Consider a string "nnnn", where I want to find all matches of "nn" - but also those that overlap with each other. So the regex would provide the following 3 matches:   nnnn nnnn nnnn   I realize this is not exactly what regexes are meant for, but walking the string and parsing this manually seems like an awful lot of code, considering that in reality the matches would have to be done using a pattern, not a literal string.
60905
There are two one-letter words in English (“I” and “a”), and according to  there are 122 two-letter words. Let $A_n$ be the number of strings of n letters that may be formed from some sequence of one- and two-letter words, by concatenating them all together.  Find $a_3$  Give an expression for an in terms of $a_{n-1}$ and $a_{n-2}$, that works for all n ≥ 3.  So far a1 makes sense to just be "I" and "a" so a total of 2. a2 would be the 122 two letter strings plus a combination of adding the one letter words (i and a) giving ai, ia, ii and aa.  This would give a total of 126 for $a_2$.  doing the combinations for $a_3$ gives 495 but that doesn't seem right as there is no evident patter to use the formula $a_n=a_1r^{n-1}$.
96107
The code i used to write     is this one  $$ X(m,n)= \begin{cases} x(n),\\ x(n-1)\\ x(n-1) \end{cases} $$   But I don't know how to write this one     I appreciate any help.   Edited: I'm sorry to add this but what if I want to write this
115288
To find the number of three letter words that can be formed from the word 'SERIES', with or without meaning and without repetition.   The number of permutations if all letters were distinct  = $^{6}P_3$.    As 'S' and 'E' are repeating, the arrangement in which 'S' are interchanged are the same, so we divide by $2!$ for 'S' and likewise for 'E'.    Number of permutations $= \frac{^{6}P_3}{2!.2!} = 30$   Which isn't the correct answer. I would like to get some help here.
8318
I have a list like so.  blue-image1.jpg, blue-image2.jpg, blue-image3.jpg red-image1.jpg, red-image2.jpg, red-image3.jpg   It's was originally a csv format but I added newlines because they needed a prefix at first. Now I need to put them together again so it becomes like this.  blue-image1.jpg,blue-image2.jpg,blue-image3.jpg red-image1.jpg,red-image2.jpg,red-image3.jpg   I tried cat list.txt | tr ',\n' ',' and cat list.txt | sed 's/,\n/,/g'  but neither seem to work properly.
101984
I am iterating over a list and I want to print out the index of the item if it meets a certain condition. How would I do this?  Example:    testlist = [1,2,3,5,3,1,2,1,6] for item in testlist:     if item == 1:         print position
68820
I am making a songbook, using the songs package. The book is in norwegian, and thus we need the norwegian letters æ,ø,å to be indexed after z. As far as i understand, this is only possible with the xindy package. Creating the index is no problem, but I want to customize how it looks. As pr. now, it looks like this:     Using makeindex, I was able to make it look correct   Here is the code for makeindex  \usepackage[makeindex]{imakeidx} % Normal LaTeX indexing \makeindex[columns=1, title=Sangregister,program=makeindex,intoc=true,options=-s idxconf.ist] % Properties of index   This is for xindy  \usepackage[texindy]{imakeidx}  \def\xindylangopt{-M lang/norwegian/latin1-test } \makeindex[columns=1,name=master,title =Sangregister,intoc=true,options=\xindylangopt]   The layout-options, is in the file idxconf.ist, which works on makeindex looks like this  headings_flag 1 heading_prefix "{\\bfseries " heading_suffix "}\\nopagebreak\n" delim_0 " \\dotfill " delim_1 " \\dotfill " delim_2 " \\dotfill "   Is it possible to use the idxconf.ist file with xindy? If not, how do I customize xindy to look like the last picture.  Here is a minimum working example:  xindy:  \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[norsk]{babel} \usepackage[texindy]{imakeidx} \def\xindylangopt{-M lang/norwegian/latin1-test} \makeindex[columns=1,name=xindytest,title =Sangregister,  options=\xindylangopt] \begin{document} start \index{a}\index{æ}\index{ø}\index{å} end blabla \printindex \end{document}   makeindex, which looks correct, but æøå is treated as symbols.  \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[norsk]{babel} \usepackage[makeindex]{imakeidx} \makeindex[columns=1, title=Sangregister,program=makeindex,intoc=true,options=-s idxconf.ist] % Egenskaper til indeks \begin{document} start \index{a}\index{æ}\index{ø}\index{å} end blabla \printindex \end{document}
68442
I know the following:  $$\varphi(2n)=\varphi(2)\varphi(n)=\varphi(n)\iff(2,n)=1$$ And  $$\varphi(3n)=\varphi(3)\varphi(n)=2\varphi(n)\iff(3,n)=1$$  But now I'm not sure what to do with this info.
1520
I could swear I've seen the function (or method) that takes a list, like this [3, 7, 19] and makes it into iterable list of tuples, like so: [(0,3), (1,7), (2,19)] to use it instead of:  for i in range(len(name_of_list)):     name_of_list[i] = something   but I can't remember the name and googling "iterate list" gets nothing.
40904
This is what I have come up with so far, but I am rather lost at lines 3-4...  $$\begin{align} (a,b)\in A\times (B\setminus C)\iff&amp; a\in A \land b\in (B\setminus C)\\ \iff&amp; a\in A \land (b\in B \land \lnot(b\in C))\\ \iff&amp; (a\in A \land b\in B) \land (a\in A \land b\notin C)\\ \iff&amp; (a\in A \land b\in B)\setminus (a\in A \land b\in C)\\ \iff&amp; (a,b)\in (A\times B)\setminus ((a,b)\in A\times C)\\ \iff&amp; (a,b)\in (A\times B)\setminus (A\times C) \end{align}$$
37616
I am struggling to find such languages $L_{1}$, $L_{2}$, and $L_{3}$ such that  $$ L_{1} \subseteq L_{2} \subseteq L_{3} $$ where $L_{1}, L_{3} \notin  \mathbb{R}$ and $L_{2} \in  \mathbb{R}$.  I know they exist, I need help finding them.