Linked Questions

1 vote
3 answers
65 views

I'm currently making a game for CompSci class, and I want to shorten our random monster fights. Is there a way to make it so when I call a def I can change the name depending on a random variable? ...
user avatar
-4 votes
2 answers
223 views

I have a function in which variables of 'node1', 'node2', 'node3' are referenced. I would like to make it so that the second time the function is called, 'node1' become 'node1_a' and on the third ...
Sam's user avatar
  • 1,062
0 votes
2 answers
166 views

I am having some problems retrieving data from a dictionary that is created in a for loop. In my code I have two dictionaries created and updated periodically, one from a machine database and one from ...
Andrew's user avatar
  • 11
0 votes
1 answer
203 views

I would like to set the variable name in a for loop, like: for i in range(5): namei = i # this is a variable name It will give me: name0 = 0 name1 = 1 name2 = 2 name3 = 3 name4 = 4 does anyone ...
Kan's user avatar
  • 169
-4 votes
1 answer
108 views

I've got an idea for a program that I'm not sure how to implement. How can I make the program ask the user something -- input() -- as many times as user responds until x command is written and (and ...
gonza's user avatar
  • 3
0 votes
4 answers
138 views

I'm having an absolute mind-block. This is my data: db_one = 1 db_two = 2 db_three = 3 db_four = 4 list_to_iterate = ['one','two','three','four'] for each_item in list_to_iterate: new_string = '...
Slowat_Kela's user avatar
  • 1,531
0 votes
0 answers
133 views

this is my first post so I am sorry if I get any formatting wrong. I have searched this before in stackoverflow and it did come up with a few responses but I didn't really understand as I couldn't ...
mre12345's user avatar
  • 1,137
-3 votes
6 answers
130 views

I am using Python 2.5. In the code below want to print either err1, err2 or err3 depending on the value of x. Is it possible to create the variables err1, err2 or err3 by joining "err" plus the value ...
bob_the_bob's user avatar
0 votes
0 answers
119 views

I want to create 6 pandas dataframes from 6 text files. I want to name them according to the names of the text files. The text files are named as 'DAPC_min.txt' and so on. I want the dataframe names ...
anotherone's user avatar
0 votes
1 answer
70 views

Python newbie here: I have a class ExampleState: ... My purpose is to create a class object unique to every user. I get the username from my client flutter app in django. So, instead of state = ...
Earthling's user avatar
  • 489
0 votes
2 answers
90 views

I have a list of IDs I'm trying to manipulate in order to get long strings of the following format: "ID1,ID2,ID3,....,IDn". that is, a long string where the IDs are separated by commas, which are ...
Optimesh's user avatar
  • 2,877
0 votes
2 answers
62 views

I'm coding a text-based adventure game for my python project in school, and I'm currently creating a fight function. It involves a lot of dictionaries, hence why I need to refer to a variable from a ...
paochy's user avatar
  • 11
-2 votes
1 answer
63 views

Sorry if the title is confusing but I couldn't think of a better way to word it. I'm making a game with a friendship system and this is essentially what I'm trying to do: playerChar = "Adam";...
Questionnaire's user avatar
0 votes
1 answer
91 views

Here is the code to start with. Ignoring all the CSV jazz if you want, the important part is the loop. import csv Teacher_Array = [] class Teacher: def __init__ (self, login, password, name, ...
user3688385's user avatar
0 votes
1 answer
41 views

if one had a list of strings, how could they create variables (empty list objects) with those names? pre_vars= ['list_1','list_2','list_3'] print list_1,list_2,list_3 >>> [],[],[] I saw ...
O.rka's user avatar
  • 31k

15 30 50 per page
1 2
3
4 5
13