Questions tagged [python]

Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability. Use the python tag for all Python related questions. If you believe your question may be even more specific, you can include a version specific tag such as python-3.x.

Filter by
Sorted by
Tagged with
0
votes
0answers
18 views

Repeat a function inside that function a certain time

Is there any way to reduce this code? It repeats itself, but I cannot find any way to reduce it because it is only repeating inside one elif. Sorry I'm a beginner my code is quite bad It repeats here: ...
-1
votes
0answers
12 views

RSA encryption/decryption using python [closed]

I'm having slight trouble with a problem with python using Jupyter notebook. So far: ...
-1
votes
0answers
9 views

Calling a nested method of a class Python [closed]

I want to test the output of the "isPalindrome" function with parameters 0 and 1. How can I call isPalindrome function directly? I tried with: ...
-1
votes
0answers
8 views

filter tweets about a specific country in python [closed]

this is a python program that eliminates tweets from outside of a specified country that checks the contact details of each tweet received and whether it belongs at least to a rectangle in a bounding ...
4
votes
0answers
19 views

Subclass of Python's multiprocessing.Pool which allows progress reporting

For context, the whole of the project code can be found here. This question was created specifically for the progress.py file. The goal behind it is to allow ...
-1
votes
0answers
10 views

Minesweeper in Python Needs Flags and Smiley Face amid small tweaks [closed]

Me and a friend of mine started coding a minesweeper game in Python but we need help on adding the right click function of the flag and the smiley face. Here is the code: ...
-2
votes
0answers
13 views

Incorrect Output. Can't get the largest and smallest number [closed]

The title is pretty self explanatory i guess. I keep getting the wrong max and min numbers. ...
5
votes
2answers
75 views

Simple number guessing game in python

The problem is to ask the user to guess a number between 1 to 100 and compare it with a random number of that range. If user guessed number is lesser/greater than the random number print "too low&...
-2
votes
0answers
12 views

I wonder why there is an r prefix in REGEX, Prints REGEX output [closed]

print (re.sub('\s+', ' ', 'hello there there')) print (re.sub(r'\s+', ' ', 'hello there there')) These Two ...
2
votes
1answer
24 views

Multi-core OpenCV denoising

I have ~40,000 JPEG images from the Kaggle melanoma classification competition. I created the following functions to denoise the images: ...
4
votes
1answer
47 views

Calculate probability that knight does not attempt to leave chessboard after at most k random moves (LeetCode #688)

I'm learning competitive programming and came across this question on LeetCode : 688. Knight Probability in Chessboard On an n x n chessboard, a knight starts at the cell (row, column) and attempts ...
4
votes
1answer
46 views

Is my breadth-first search function any good? (Python demo included!)

I am learning Python and I wrote a functional breadth-first search algorithm which I wanted to be as general as possible. I wrote some code to draw a grid and visually show the path found. My code ...
-2
votes
0answers
13 views

reading txt file into a data frame, excluding commas and pound [closed]

Here is a short sample of my txt file, county-covid-data.txt ...
6
votes
1answer
452 views

Generate combinations of a given sequence without recursion

Given an array of unique numbers find the combinations Doing a deep copy in the code to avoid changes to the passed obj by reference This has a run time of \$O(n \times \text{#ofcombinations})\$ - can ...

15 30 50 per page
1
2 3 4 5
903