Skip to main content

All Questions

Tagged with
0 votes
1 answer
15 views

Modify the values in a (global) list of dictionary without reference

I'm new to python - being an educator trying to write to python script to score student's performance downloaded from an online polling platform. I've solved most problems until something like this: I'...
Chris H's user avatar
1 vote
2 answers
39 views

Defining global lists in Stata if elements consist of several words

I need to make some operations with many Excel files with long names of the type "Saratov Region.xls" (I mean that names of these files contain one or more blank spaces). I tried to write ...
Andrei Malokostov's user avatar
0 votes
0 answers
24 views

How can i list root objects JavaScript [duplicate]

So I have several objects and classes in my script tag const Main = {} const App = {} class Game {} let state = 777 etc. I'd like to list them. I've tried Object.keys(Object.getOwnPropertyDescriptors(...
agiopnl's user avatar
  • 1,287
1 vote
0 answers
27 views

Difference in scope between int and list in Python code [duplicate]

I have the following Python code snippet: # code 1 # makes an error def func1(): a += 1 a = 1 try: func1() print(a) except UnboundLocalError as e: print(e) # code 2 # makes no ...
심재승's user avatar
0 votes
0 answers
53 views

Add values into a list

Hope you're all good. So, I have this code where at the end, I'd like to append values to a global list, but when I call the list, it returns an empty list. It's not adding the values that the ...
Angel Panda's user avatar
0 votes
2 answers
53 views

python beginner - function can't see variable array assigned outside the function - UnboundLocalError: local variable 'n' referenced before assignment

Netbie programmer learning in Edube doing tic-tac-toe project. Still building the code but part stuck on is when testing to assign [12] (instead of X or O just yet) to list array n defined outside the ...
johnlally208's user avatar
1 vote
2 answers
557 views

How to convert a string to a variable name in python

I have a list of two strings: x = ['feature1','feature2'] I need to create the following list y from the list x: y = [feature1, feature2] How can I do that in Python?
Giampaolo Levorato's user avatar
0 votes
4 answers
487 views

Passing string for variable name Python

I am writing a program that can take in three numbers and three letters on seperate lines. The program will then seperate the numbers into items of a list and will do the same for the letters in a ...
TRCK's user avatar
  • 213
0 votes
1 answer
37 views

why list is giving output like this? [duplicate]

i got surprised by the output from the following code code: asal_list=list() sol_list=[] given_list=[1,3,6,7] target=7 def calc(given_list,i,sol_list,target): if i<=len(given_list): if ...
7_Baira Praveen's user avatar
0 votes
1 answer
232 views

Referencing a global variable out of a list

I have a list of variables (t0,t1,t2). Each value on this list is also associated with global variable. How do I go about referencing the global variable value by calling from the list. I keep just ...
96jeremy's user avatar
1 vote
2 answers
200 views

R - Why does my function appear to work but not update tibbles within a list?

I have a list of tibbles and use the code below I expect that each tibble in the list will have a column added with a factor (one of 16 levels). I can see exactly what I want being printed to the ...
LeanneB's user avatar
  • 69
-4 votes
3 answers
2k views

Appending to the list outside function in python not changing the list [closed]

lst_val = [] def func(): for value in any_list: global lst_val lst_val .append(value) I'm using the above code to append values to a list outside of function. But, it is still ...
Saili Gaitonde's user avatar
2 votes
2 answers
115 views

How can I capture the data frames from a list in Python Pandas?

I want to combine data frames with different columns in Python Pandas. import pandas as pd first_df = pd.DataFrame({ 'a':np.random.randn(6), 'b':np.random.choice( [5,7,np.nan], 6), 'c':...
Hamideh's user avatar
  • 685
0 votes
1 answer
1k views

Python global variable is not being accessed in function

This is my python module that is being ran as two threads in main. One thread runs monitor_wind() which adds to wind_count every spin and another thread runs calculate_speed() to get wind in mph from ...
steve51516's user avatar
0 votes
1 answer
907 views

How to Pull Email Address from Global Address List in Outlook VBA if the Associated Name contains String

First time poster! I am trying to pull the email address from an entry in the Global Address List in Outlook to refer to within my VBA code. I need to input a project code, whereby the code will need ...
MarkSmith's user avatar

15 30 50 per page
1
2 3 4 5