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
6 views

Simple and insecure Python Password Manager

Out of boredom, I decided to start my personal project and I've chosen a simple Text Password Manager. Note: For anyone out there, I strongly recommend you NOT to use this for any sensitive storage ...
3
votes
4answers
16 views

Basic Blackjack game in Python

I've only been learning Python for a few days after a Humble Bundle book sale, but I made a functional Blackjack game on which I'd like some constructive criticism as far as my coding structure and ...
2
votes
2answers
13 views

Check header files for namespace usage

To ensure there are no naming conflicts within our project (C++) I was tasked with writing a python script to check all of our header files for any occurrences of a ...
3
votes
1answer
15 views

Is this an optimal implementation for the knapsack algorithm?

I have implemented a solution for the knapsack problem while breaking an item is allowed. I've used the dictionary data structure where I used weight as a key and value per weight as a value. After ...
3
votes
1answer
18 views

Simple rainfall animation in Pygame

I made the following code. It's a simple animation of 'raindrops' falling and splattering once they reach the ground. The images I use can be found here: https://imgur.com/a/VYV07ef ...
-3
votes
0answers
10 views

Python's UnboundLocalError and inline variables' assignment [closed]

Here's a method which returns a method which each time called returns the next fibonacci number (0, 1, 1, 2, 3, 5, ...). ...
-2
votes
0answers
17 views

Vending Machine Project - Python OOP [closed]

I have been working on a vending machine project which is outlined below. After selecting 'b' in the first menu, I am having trouble with comparing the selected item cost with the total amount ...
3
votes
1answer
22 views

Name Mashup Program Improvement in Python

I am learning python and trying to solve different problems i came across this program which is name mashup which is in Get Programming:Learn to code with Python. problem statement: Write a program ...
2
votes
1answer
25 views

Instagram Scraping Posts Using Selenium

Python script that can download images and videos of the user, like Gallery with photos or videos. It saves the data in the folder. How it works: Log in in instragram using selenium and navigate to ...
0
votes
0answers
12 views

A register of government decrees, authenticated with blockchain and public key cryptography (2)

This is a follow-up question to this question, having carried out some of the advise kindly provided by other users. The full repo is here, but I'll post the most important extracts below. ...
2
votes
0answers
24 views

How to adjust Python backtracking sudoku solver with forward checking

I'm solving basic sudoku puzzles with backtracking, but it's slow. I want to update the domain for each field on the grid, but I don't know when or how to update the domain to remove invalid entries. ...
-2
votes
0answers
8 views

how can i use two types of queryset models override save method? [closed]

i want to ask you if i POST an article with featured=True then the old featured=true get transferred to featured=false queryset. i just want two [:2] values in featured=true queryset. here is the ...
1
vote
1answer
22 views

What would be the computationally faster way to implement this 2D numerical integration?

I am interested in doing a 2D numerical integration. Right now I am using the scipy.integrate.dblquad but it is very slow. Please see the code below. My need is to ...
-3
votes
1answer
26 views

Python guessing game, lottery numbers but using def [closed]

So my task was to make a lottery function, but the instructor only provides half the code when explaining and going through my resources i was unable to find proper examples on how to complete it ...
3
votes
1answer
27 views

Dynamic web scraper in Python

The other week I faced the struggle of scraping dynamically generated content. So I used the selenium library with combination of requests & bs4, the thing is I am unsure of the quality of the ...
8
votes
2answers
322 views

Calculate the intersection area of two rectangles

I want to calculate the intersection of two squares where the coordinates of the input square are given by the bottom left corner and the top right corner. The other square is 6 units wide and has a ...
0
votes
0answers
25 views

Design of a turn based, dice game [closed]

I'm trying to build a irc-bot that serves as a manager of a multiplayer, turn based, dice rolling game. The bot is listening to all messages on the channel. When the logins it build a ...
1
vote
0answers
26 views

Making a priority queue using a Heap. Without using queue or heapq

I have to implement a priority queue using a heap without any library / package for priority queue or heap. I made a BinHeap class which is a min heap, and I made a priority queue class with enqueque, ...
1
vote
0answers
18 views

A simple animation in pygame

I'm following a tutorial into pygame. I realized the example code was written for the sake of being easy to understand. I wondered if I could 'improve' the code, with a focus on keeping the exact same ...
1
vote
1answer
26 views

Finding data relations of json paths in python

I am kind of new to python, so I am pretty sure there are way better elegant ways to do this. I have made a function that is able to compare two list of possible json object paths, and detect what ...
1
vote
0answers
19 views

Improving loop through xml files ad add to DF

With this code, i loop through similar xml files and add them to a DataFrame. How can i make this code better so it is more pythonic? ...
2
votes
0answers
30 views

A self contained parser generator implementation

This is a recreational project, I was trying to make a parser generator with a grammar inspired from: https://docs.python.org/3/reference/grammar.html Unfortunately, understanding that specific ...
-4
votes
0answers
19 views

Input in python3 [closed]

Can a program in python, take input in the same line like in C, where we can can use scanf to take input differentiated by space? And, how. In C, ...
2
votes
1answer
27 views

Simple GUI unit converter with tkinter

I happened to delve into tkinter and created a couple of mini projects so I could get more familiar with it. I was wondering if there was any portion of my code or code structure that is sloppily ...
0
votes
1answer
28 views

Python Alien Blitz Game

Please review my Python Alien Blitz Game code. There are several points I'm keen to hear about. I used globals. Was that an evil choice given the context? In the past when I've tried to refactor ...
-4
votes
0answers
15 views

Python Caesar cipher encryption [closed]

I have the majority of the code done for the encryption of the input and shift. I'm at a complete loss when trying to implement the capital letters to re-wrap around after trying to go beyond Z. Here ...
-6
votes
0answers
31 views

hello world!!!- ANY WAY TO OPTIMIZE GIVEN CODE [closed]

`print('hello world') print('hllo word') print('helo Wrld') print('hell orld') print('helloworld')` OPTIMIZE THE GIVEN PROGRAM
3
votes
0answers
22 views

Remote to remote copying of files

I've written a function to copy files remote-to-remote using SCP command, paramiko, pexpect, and paramiko-sftp. I want to make my code efficient; I'm new to Python and I don't know how. Here's my ...
1
vote
3answers
46 views

Scraping the Bundesliga table and saving it to CSV

Wrote my first mini-script to get data from the german football league table and save the data to a csv file. Do you like the approach or could I be more efficient? Thanks in advance! ...
0
votes
0answers
20 views
+50

Inserting data from client-side to MySQL via Flask-Sqlalchemy

I am creating a Bill of Materials (BOM) web app with flask as a backend. As a part of this app I am inserting data into BomStructure table from ...
0
votes
1answer
15 views

animate button presses in a sequence (tkinter)

I am attempting to animate the series of button presses in the simon game I am creating with tkinter. The animate method is called for each button that needs to be pressed in the series. It currently ...
1
vote
1answer
46 views

Python prime finder

I wanted to try and learn multi-threading, so I thought it would be good to make a small program normally first and make it multi-threaded, so I made this prime finder. ...
5
votes
1answer
140 views

Simulation of virus growth

The gist of my program is to simulate the growth of some virus. I used (attempted) OOP concepts to break down the problem into chunks and have the chunks talk to each other. Not sure if my ...
-3
votes
2answers
43 views

How Do I Use Subtraction on a List? - Python [closed]

When using lists to store information, how does one perform math on it? No in a (list * y) sort of way or a a = (list(3)+list(4)) sort of way. Instead, something like this: List = [1, 2, 3, 4, 5, 6, ...
0
votes
0answers
12 views

Simple two-mode camera for graphics engine

I have a camera class that I use with my graphics engine prototype. For context, the graphics engine is written in OpenGL(4.1) using Qt-bindings (PySide2), since I also used Qt as my window and ...
0
votes
1answer
21 views

naive suffix tree construction in Python

I'm not certain if my implementation is correct, it appears to be, but looking for any feedback as far as readability and efficiency goes. Obviously using dictionaries isn't particularly efficient ...
1
vote
1answer
22 views

Finding matches in Excel files, adding to a Pandas Dataframe

I have a business requirement where I have to read excel files and match each cell with a given keyword list and find the matches and write it into a dataframe. I have written the code, but when the ...
-2
votes
1answer
30 views

Python code refactor to use multiprocessing [closed]

I have written some Python code that opens files one by one, does some work, and writes data onto the filesystem. I figured, I want to make use of my cores.I've refactored the program into this. <...
1
vote
0answers
19 views

Python put from txt file into array(multiple line) [closed]

Im kind new to programming and I'm working with STL files (in ASCII format). Basically I need to create an array of several lines, and in each line of that array I need to insert 12 positions of a ...
-2
votes
0answers
18 views

Multi Digit Subtraction Calculator - Python [closed]

I was trying to make a multidigit calculator. A simple program, but I started python about 2 weeks ago, so I'm not very advanced. Anyway, I was trying to add the subtraction function into my ...
2
votes
0answers
29 views

simple neural network in python

I've spent the last few days learning the beginnings of how to implement a simple neural network. I've gone through chapters 1 and 2 of this book and have tried to write my own NN with referrals to ...
2
votes
0answers
36 views

ML text generating code with Python and Tensorflow

I wanted a simple code review for improvement to increase the efficiency of my text generating model. This model is taken from the official TensorFlow site but is being trained on different datasets. ...
4
votes
1answer
63 views

Code for wireless communication work

I need some pointers on how I can speed up my code, as of now it is incredible slow for larger inputs. The way the code works is that the file Loc_Circle_50U.txt contains the true locations of 50 ...
8
votes
2answers
323 views

Navigate objects from a path provided as a string

Recently I wrote a validator for some objects. To increase usability the validator gives the user hints on how to fix some of the found issues. Since the application is around something programmatic, ...
2
votes
1answer
59 views

Find the Percentage from HackerRank

I am learning python by solving python module from HackerRank. This problem is Find the Percentage. You have a record of N students. Each record contains the student's name, and their percent ...
-2
votes
0answers
50 views

Python Virus Spread Simulation with Markov Chain Random Walking [closed]

So in the light of the current situation and because of a home lockdown in my country I decided to try myself in a simple SIR Model Simulation in which I create a simple world with people who could be ...
0
votes
2answers
70 views

Comma separated string for list [closed]

I do not have an intention to ask for an answer, but I want to know if my answer is good for a two-week Python beginner? Question: (Automate the Boring Stuff with Python/ page 102) Comma Code Say ...
3
votes
1answer
45 views

wrote a blackjack game in python , would like you get notes on it

I started learning python online and I wrote a blackjack game as my first little project. I would like to get some review on it if possible. (how to make it better , simpler , etc) ...
2
votes
1answer
35 views

Nested Lists from HackerRank

I am a beginner in python. This is the Nested Lists problem from HaackerRank. Given the names and grades for each student in a Physics class of N students, store them in a nested list and print ...

1
2 3 4 5
239