All Questions
235
questions
-1
votes
1
answer
34
views
difference between local and global dependencies in angular
What is the difference between downloading local and global dependencies? For example, if I run "npm i bootstrap" in the project folder, will I download it from the location?, and if I want ...
-3
votes
1
answer
109
views
local variables outside a function in python [duplicate]
i have a code that goes like this
def inputs():
q_number = int(1)
number_of_q = int(0)
q = {}
x = {}
y = {}
xxxx = 1
for i in range(4):
C = float(qq[xxxx].get())
...
0
votes
0
answers
27
views
Local variable referenced before assignment. Global Variable not read inside function. [Python 3.7]
I have two global variables being declared just outside a function. When I try to access their values just inside the function, one of them gets identified while the other fails to get accessed. [...
-3
votes
1
answer
65
views
Why is there no difference in the two results between the global array and the local array?
I turned global arrays into local arrays in the main() function to solve my homework for C++. I expected the program to produce an error, but it outputs the same result without any error.
What's the ...
-2
votes
4
answers
495
views
Static variable in global and local scope
I want to know what is the difference between declaring a static variable locally and globally, because in below example.
If results do not impact, then why we have two scopes for static?
#include <...
0
votes
1
answer
144
views
Global Variable becomes local
If the title is a bit cryptic (I have no idea how to put my issue in one title) here the explanation.
I have a global variable
ex = False
orig = id(ex)
Then, I have two functions:
def start(test):
...
1
vote
2
answers
41
views
why this local parameter can change global parameter?
why
aaa can not be changed
but
bbb can be changed?
aaa = 100
def plus():
aaa = 8 #aaa=8
plus()
print(f"aaa = {aaa}") #aaa = 100
bbb = [100,8]
def plus2():
bbb[0] = 5 #bbb=[5,...
0
votes
1
answer
59
views
Global or local when creating a function
Hey I'm trying to write a basic assembler it doesn't even do real machine language,
the premise is to learn how to code in c ansi 90.
I have made a function that gets a string that supposedly has an ...
1
vote
1
answer
651
views
Pyomo glpk solver doesn't give me the optimum
I hope someone can help me. I am practicing with optimization modelling and I am solving the following LP problem using pyomo glpk:
max z = 4x1 + 3x2
Subject to:
x1 + x2 <= 40
2x1 + x2 <= 60
x1,...
0
votes
2
answers
765
views
Is it possible to take the Local Variable of a Function and convert it to a Global Variable or use it in an other Function
I'd like to know, If I can use the Local Variable of a Function (I'll call it for now Fct.1) in an other Function (Fct.2) (so that a variable in Fct.2 is assgined the same value of a Variable in Fct.1)...
0
votes
1
answer
246
views
function executed by setInterval() multiple doesn't show results | Javascript
I am making a timer in javascript. But there is one thing I am not getting.
Here's the code...
var time = 0;
var timeInterval;
var testTime;
//Main code which increases the value of variable time by ...
-1
votes
1
answer
102
views
Python local variable to global variable
I'm trying to write a modular script, with functions
-Function 1
age = input("tell me your age : ")
-Function 2
weight = input("tell me your weight : ")
-Function 3
birthday = ...
1
vote
1
answer
206
views
Are variables used in nested functions considered global?
This is a dumb question, so I apologise if so. This is for Julia, but I guess the question is not language specific.
There is advice in Julia that global variables should not be used in functions, but ...
0
votes
0
answers
101
views
How to encode the passed data to JSON in the form in Flutter?
I have passed the data in a variable of the previous screen to the next using the guidance of the chosen answer in this post: Passing data between screens in Flutter
That variable should be encoded ...
0
votes
1
answer
76
views
Python global and local variable inside function
I am confused with this part of the code (what I pasted here is simplified version of the actual code).
When I run the following code:
def function_1():
apples = 0
apples += 1
print(apples)...