Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
18 views

def rods_to_meters(rods): meters = rods * 5.0292#converts rods to meters and stores in appropriate variable. return(meters) def rods_to_feet(rods): feet = (rods * 5.0292) / 0.3048#...
swappr's user avatar
  • 11
0 votes
0 answers
46 views

This is a nested function inside a function that I defined. But somehow the webdriver in Headless mode just won't perform the xport.click function. This function WORKS on a regular window but won't in ...
Nolan Padalhin's user avatar
0 votes
0 answers
21 views

Consider the following code snippet: def part1(): flist = [] for i in range(10): def hello(): print(f"Hello {i = }.") flist.append(hello) for f ...
Audra Jacot's user avatar
1 vote
1 answer
85 views

This is a dumb example based on a more complex thing that I want to do: from typing import Generator def f() -> Generator[list[int], None, None]: result = list() result.append(1) if len(...
Vedran Šego's user avatar
  • 3,815
1 vote
1 answer
219 views

I am a little confused about the variables' scope in a nested function in MATLAB. As nested function help docs explains: vaiable remains local to the nested function. function main nestedfun1 ...
Hamburger's user avatar
1 vote
2 answers
66 views

I need some help to get how some function export works inside JS. Let's say I have this code function goodbuy() { console.log('bye'); } function myModule() { function hello() { console....
Vladyslav Archivadze's user avatar
0 votes
1 answer
121 views

I want to build a class which is merely a wrapper for some data. This is the basic idea: class Fruits: fruits = [ 'apple', 'orange', 'cherry' ] My fruits aren’t strings, though, but classes ...
Alfe's user avatar
  • 60.2k
-1 votes
2 answers
72 views

Somehow I can't manage to use a previously defined function inside another one. Is that possible? def generate_password(length): import random password = str() alpha_num = [i for i in '...
Atagawa's user avatar
  • 17
0 votes
1 answer
32 views

Given the following code def alpha(num, proc): def beta(): print(num) if num == 1: alpha(2, beta) else: proc() def gamma(): pass alpha(1, gamma) I expected the ...
MPP's user avatar
  • 49
0 votes
1 answer
102 views

So I was developing a GUI with tkinter and I have realised that I have so many nested functions in my code that I think it is not a good practice. However, I think my code will not work without using ...
Oguz Gokyuzu's user avatar
1 vote
2 answers
240 views

I have to calculate the number of missing values per observation in a data set. As there are several variables across multiple time periods, I thought it best to try a function to keep my syntax clean....
Ian's user avatar
  • 53
0 votes
1 answer
812 views

I want the greet function to say "Hi Sam, Hi Cody" using the format function but I am getting this error: greet(names()) TypeError: greet() missing 1 required positional argument: 'y' def ...
SJG's user avatar
  • 13
-2 votes
2 answers
924 views

Why I continue getting the error : missing 1 required positional argument: 'category_id' when the argument is already passed within query function in Backend class? I also don't understand the error ...
B _J's user avatar
  • 9
0 votes
1 answer
183 views

When a function is created inside a function, the following code is returning a string with the name variable coming back as undefined. Since this is functionally scoped inside the global scope, I ...
Ben Merryman's user avatar
0 votes
1 answer
738 views

f1<-function(x,y){ f2<-function(a,b){ print("f2") return(a+b)} f2(x,y) print("f1") return(x-y)} f1(8,5) I was trying above code to figure ...
sam's user avatar
  • 61
3 votes
1 answer
158 views

I am trying to implement a count variable in the function below using dynamic programming specifically memoization. The method calculates the value in a Fibonacci sequence at a given index. I cannot ...
Faisal Khan's user avatar
15 votes
1 answer
2k views

For example, public int DoSomething(in SomeType something){ int local(){ return something.anInt; } return local(); } Why does the compiler issue an error that the something variable cannot ...
Frank's user avatar
  • 1,110
0 votes
1 answer
662 views

I edit my C code with VS Code (1.17.0) with C/C++ Extension (1.12.0) that provides error checking. I compile my code with GCC compiler that supports nested functions. So if I write this int foo(int x) ...
Sun of A beach's user avatar
-1 votes
1 answer
60 views

How to call a nested function with only a string? eg: function oot(wha) { function inn(wha) { First.innerHTML+="Inner ["+wha+"]"; } oot....
jobeSW's user avatar
  • 49
0 votes
1 answer
44 views

I've never used the nested functions before, and this seemingly simple task is giving me trouble. When I run this code only the first function work, and the second is completely unresponsive. const ...
user avatar
-1 votes
4 answers
135 views

I tried to write a nested function to calculate the area. However, the program showed the name circle is not defined. Could anyone please help providing a suggestion about this nested function ...
Don Adventure's user avatar
63 votes
1 answer
4k views

I'm new to Rust and have been looking through the source code a bit, and found this: #[stable(feature = "fs_read_write_bytes", since = "1.26.0")] pub fn write<P: AsRef<Path&...
Challe's user avatar
  • 731
0 votes
2 answers
879 views

So I came across a momoize function when I was trying to understand how memoization really works, the solution has really had me thinking, the code below const memoize = (fn) => { const cache ...
Marshall's user avatar
0 votes
1 answer
127 views

I was trying to solve a codewars problem here, and I got a bit stuck. I believe I should be using nested currying in Python. Let us just take the case of add. Let us constrain the problem even more, ...
display_name_undef_123's user avatar
0 votes
5 answers
258 views

i have two nested functions, i want to call the second one inside the first one but i nodejs doesn't seem to recognize it. function Main(){ this.NestedA = function(){ console.log('Hello from A') ...
Oliver Karger's user avatar

1
2 3 4 5
9