Spreadsheet how to get rows of filled cells [closed] - google-sheets

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 months ago.
The community reviewed whether to reopen this question 9 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I would like to know if there is a way to do the following in a spreadsheet (Excel, Calc, etc.).
If I start from the following spreadsheet:
A B C D E F G H I
--------------------------------
1 | X X X
2 | X X X X
3 | X
--------------------------------
I would like to be able to get the columns that contain some value in the range that I have passed. For example:
Function(A1:I1) = {C,E,F}
Function(A1:I1) = {B,E,G,I}
Function(A1:I1) = {A}
Can you think of any ideas to get what I need? Any ideas would be greatly appreciated.

try:
=ARRAYFORMULA(REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE(
IF(B2:J10="",,B1:J1&",")),,9^9))), ",$", ))

Related

Numbers equal to the sum of powers of its digits, need faster python code [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
In Python, create a function finding all integers between 1 and 1.000.000.000, which are equal to the sum of k'th power of its digits for some k.
Example: 4150 = 4^5 + 1^5 + 5^5 + 0^5.
Here is my code working perfect until 1.000.000. However, it becomes so slow for large numbers. I try Numpy but it does not work. Any improvement would be welcome. ^^ (Any library or python function you may use)
def powers(n):
s = []
for number in range(1, 10 ** n):
number_list = [int(x) for x in str(number)]
if max(number_list) > 1:
total = 0
power = 1
while total < number:
total = sum([y ** power for y in number_list])
if total == number:
s.append((number, power))
power += 1
return s

Generator with condition in F# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
if you know, how I can write generator with condition in F# - tell me please!) something like that:
let res = [for i in 1..5 if i % 2 = 0 then i]
printfn "%A" res
You were almost on the right track.
let res =
[
for i in 1..5 do
if i % 2 = 0 then
yield i
]
The feature you're looking for is list comprehensions.
This is similar to yield return in C#. The same comprehensions are available for seq and Array.

Error <name> expected near "if" [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Hi this is my first lua code but I get a error pls fix it thx in advanced if you do get this working. I have a feeling its a small thing I'm missing.
class 'Autochat'
TalkTimer = Timer()
local TalkDelay = 1 -- in minutes
local active = 1
function
if active = 0 then
return
end
if active ~= "0" then
if(TalkTimer:GetSeconds() > (60 * timeDelay)) then
Chat:Broadcast("Hi the admin is offline.", Colors(0, 255, 0))
TalkTimer:Restart()
end
end
end
Autochat = Autochat()
The function is missing a name. Lua reads to the next line looking for the function's name and gets confused when it finds an if statement.
Also, the first if statement should be if active == 0 then because == is the comparison operator.

How do I find the memory location of items on the stack? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
In an interview, I was asked:
You are given a stack with starting address of 0th. The value of the stack is 1000 and each location can store 8 bytes of data. What is the memory location of 42nd element ?
Let's look at some values and try to find a pattern.
0 -> 1000
1 -> 1008
2 -> 1016
It starts at 1000 and goes up by 8 each time, so
n -> 1000 + 8*n
42 -> 1000 + 8*42
42 -> 1336
It is quite simple.
Element[0] = Memory[1000]
sizeof(Element) = 8
Then:
Element[42] = Memory[1000 + 8*42]
#Time S.
The statement "it grows up" is not necessarily true.
It can also grow down.
So you second example is more correct. N can be negative in that case.

math.random function with step option? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
A custom function that will return a random number with a step option available like in the for loop.
Example:
for i=1,10,**2** do
print(i)
end
Do you mean this:
function randomWithStep(first, last, stepSize)
local maxSteps = math.floor((last-first)/step)
return first + stepSize * math.random(0, maxSteps)
end
This gives the same behavior as math.random(first, last) except that the values will be "stepSize" apart. Note that the highest random # may not be "last", depends if (last-first) is a multiple of stepSize.

Resources