2,207,744 questions
0
votes
1
answer
45
views
Can someone help me not make the code terminate whenever i input "right"
i understand this is seemingly simple im a beginner i apologize if ive wasted anyones time but im pretty lost rn heres my code
print ("you awaken in a dark room")
print ("you look to ...
Advice
0
votes
3
replies
32
views
Terminal closing after outputting code result
I'm new to coding, and I'm trying to use VS code to learn Python. I had an issue when I ran the debugger. I got some extra output showing something like this:
PS C:\Users\user\Desktop\Python\oops> ...
1
vote
1
answer
26
views
Distributed computing with Ray/Python has no parallelism at all on GCP
I am trying to setup a distributed environment for NLP processing. I use Ray and Python on GCP. I have a master and several workers. What happens is that when I run 1 worker or 8 workers, it takes ...
Best practices
0
votes
1
replies
21
views
How to Use Threading in Python (and How to Go Beyond It)
The Direct Answer to the Original Question
If you simply want to run a function in a separate thread, the minimal working pattern is:
import threading
def worker():
print("Running in a ...
Best practices
0
votes
1
replies
21
views
Namespace tracking best practices
I'm new. Is it best practice to make a list of the variable's "namespace," and if so, what are some of the methods to track them that others might use? Are there other things that should be ...
1
vote
1
answer
27
views
Tensorflow Keras CV tutorials incorrectly working
I have an intersting error. I'm starting learning Machine Learning by Tensorflow Keras CV tutorials and two of my tutorial projects working incorrectly
I use this tutorials:
https://www.tensorflow.org/...
-1
votes
0
answers
39
views
Select 3 random items from a 2 column list [closed]
For a role-playing game, I want to create an NPC generator.
The skills are stored in a CSV file with 2 columns, e.g.:
Kraftakt (KO/KK/KK),KTL
Überreden (MU/IN/CH),GTL
Geographie (KL/KL/IN),WTL
where ...
Advice
0
votes
1
replies
44
views
How do i fix the string limit of my code?
So i wrote this code which is used for parsing the information from the webpage to te text file. it works fine but it can write down only 501 string in the txt. How can i fix the code to remove this ...
Advice
0
votes
4
replies
57
views
Finding substrings from the string using sets: algorithm's logic
I was solving the algorithm problem: find all unique substrings from the string, using sets.
Here is the model solution, but I can't understand what line 6 means. Why does the end go up to length + 1? ...
Best practices
2
votes
5
replies
66
views
Python script interface
I have a few python scripts that I want to run on a small raspberry pi project I've been working on and I want to use a launcher or something so I can launch them without a pc or anything does anyone ...
2
votes
1
answer
46
views
Why does SteamGifts return a 403 response when I access SteamGifts in Python code?
Here's the Python code
import httpx
url = "https://www.steamgifts.com/"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 ...
0
votes
0
answers
34
views
How to install pyaudio for python 3.6 on win7,32-bit PC (with VC++ v.14.29.30139 already installed)
I am trying to install pyaudio on an old win7 32-bit laptop, with Python 3.6.8 already installed.
I have installed the latest compatible version of pip, and then numpy and mapplotlib.
I issue the ...
3
votes
1
answer
80
views
Why does the cumulative sum over each group result in all 1's?
With Pandas I am using .groupby().cumsum() to generate a count column:
import pandas as pd
df = pd.DataFrame({'ID':['A','B','A','A','B','B','C','D','D','C']})
df['count'] = df['ID'].ne(df['ID']....
-6
votes
0
answers
76
views
Recursive keypad combination not generating correct result in Python [closed]
I am trying to implement a recursive function to generate keypad combinations (like old mobile keypad).
d = {
'1': "abc",
'2': "def",
'3': "ghi",
'4': &...
Best practices
0
votes
10
replies
60
views
Indicate to Python user that the __init__ constructor should only be used by the class
I have this design for the following class:
class MyClass():
a = None
b = None
def __init__(self, a, b):
self.a = a
self.b = b
@classmethod
def init_from(cls, c):...