So, "H_LLO" ==> ["HALLO", "HBLLO", ... "HZLLO"] (length is 26)
However, Scrabble has 2 blank tiles, so I can't just do a simple for loop and replace.
For example, "H_LL_" ==> ["HALLA", "HALLB", ... "HBLLA", ... "HZLLZ"] (length is 26x26 = 676)
What is the cleanest way to do this? The best I could come up with is the following, but I don't much like it:
import re
from itertools import product
w = "H_LL_"
expanded = []
product_args = list()
for _ in xrange(w.count("_")):
product_args.append( map(chr, range(65, 91)) )
for repl_str in product(*tuple(product_args)):
wtemp = w
for c in repl_str:
wtemp = re.sub('_', c, wtemp)
expanded.append(wtemp)I have a question about regression to the mean.
Suppose you have a set of pairs (a,b) corresponding to students in a class. a = the student's score on the first midterm, b = score on second midterm.
If you plot the pairs with a on x-axis, b on y-axis, then get the least-squares line, you have an upward sloping line.
The line slope should be less than 1, indicating regression to the mean.
If you plot b on x-axis, a on y-axis, the slope is necessarily now greater than 1. But I fail to see what has changed in the analysis -- a and b are both just supposed to be samples from the same distribution, right?
This has been driving me crazy, so I'd love some help.
Thank you!