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
2
votes
0answers
35 views

Log tailing socket server

Each client application would send a filepath and search term to the server. The server then takes that file path reads the file and returns any lines that contain the search term, the server then ...
5
votes
1answer
130 views

Project Euler problem 26 in Python

Question statement: A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given: ...
2
votes
1answer
150 views

Strong Password Checker (Python)

Problem Write a program to return True, if a string is a strong password. A password is considered strong if below conditions are all met: It should have at ...
4
votes
1answer
85 views

N queens problem in python

I just tried to create a program for the N queens problem. ...
5
votes
4answers
259 views

Tic Tac Toe Game in Python 3

I made this as a personal challenge. It seems to work fine as I can't find any bugs and am happy with how it runs, but I am interested in what I should do to make the code more professional. Note: ...
2
votes
1answer
45 views

Timsort implementation in Python

I wanted to implement a Timsort in python. Here's what I've come up with: ...
4
votes
3answers
97 views

Finding sequential recurrences in a list of numbers

I have a list like this: seq = [-2,3,-2,3,5,3,7,1,4,-5,1,4,-5,1,4,-5] I want to get all the sequential recurrences and where it happens, I feel the way I'm doing ...
-2
votes
1answer
71 views

Parallel Calling of Function for Non-linear Solving

The end goal of my program is to use a non-linear solver to fit a set of parameters to my data set. I pull the data set from a database into a list sprays, then ...
4
votes
0answers
34 views

Better performance in read/write data structure + byte

I am writing a program to compress an image using Huffman encoding and I need to write the data structure and the byte file. After that, I have to read/decode it. I realize that my read and write is ...
5
votes
2answers
337 views

Simple BMI Calculator (Python 3)

As my first Python program I have written a simple BMI calculator. I want to know how i can improve this program. Would functions be useful? How can I improve the way that it is presented? ...
0
votes
0answers
44 views

Parsing large JSON files

I have the following code for reading a json file into pandas dataframe and parsing the fields, but it is too slow for large files. Is there a way to make the code more efficient? ...
6
votes
0answers
61 views

Snake game in Python with tkinter

I created snake as my first program with GUI, I didn't learn OOP yet, so my program has no classes. I know that I should use comments, I am sorry. Short instruction: l - increase snake speed k - ...
3
votes
1answer
77 views

Update Google Sheet with Python

Below is a code to update a google sheet using the database values. The script is working fine but it is rather slow because of the sleep function which I have to put because of the "Quota exceeding ...
3
votes
1answer
74 views

Linked List implementation in python 3.x

I took this as a challenge and implemented linked list data structure in python ...
3
votes
1answer
5k views

Leaderboard in Python3

Could someone tell me their opinion on my leaderboard system? library ...
6
votes
1answer
340 views

Tic-Tac-Toe with changeable board size (Part 1)

Part 2: Tic-Tac-Toe with changeable board size (Part 2) I've created a Tic-Tac-Toe program with python which has a option to change a standard 3x3 board to NxN board. I've also created easy, hard and ...
9
votes
3answers
1k views

Counting without zeroes

Below is a python script that generates the sequence ['a', 'b' .. 'z', 'aa', 'ab' .. 'az', 'ba', 'bb' .. 'zz', 'aaa', 'aab', ..] This is essentially counting in ...
2
votes
1answer
33 views

Batch retrieve formatted address along with geometry (lat/long) and output to csv

I have a csv file with 3 fields, two of which are of my interest, Merchant_Name and City. My goal was to output multiple csv ...
4
votes
2answers
90 views

Run length encoder decoder

The code works not only as a normal run length encoder and decoder, but it also works for values like 3ABC (Prints ABCABCABC), ...
2
votes
1answer
64 views

Scrape company data from Google search

I have written this code for crawling and scraping search results from Google. But it's super slow when I run it. What it does: read a pandas column, search values in Google and take the first result ...
4
votes
1answer
118 views

Automate html file editing with python - Change the author

Hello I would like to use python to change the author of an html file, in order to do so I have written a few lines. First I have used the HTMLParser class from ...
3
votes
2answers
74 views

Morse code encoder decoder

I created this morse code encoder and decoder. ...
2
votes
1answer
48 views

Python - Automate code involving suffix [closed]

I am trying to automate this portion of code in python (code shown for 2 polygons, I am trying to do the same for 10 000 polygons). Any ideas on how to implement this using ...
2
votes
1answer
81 views

Tic-Tac-Toe with changeable board size (Part 2)

Part 1: Tic-Tac-Toe with changeable board size (Part 1) I just revisited all my previous questions and saw that I hadn't updated my Tic-Tac-Toe code. So, I improvised my code as per @Austin Hastings ...
2
votes
1answer
64 views

Quadratic “Complete the Square” Solver in Python 3

I quickly wrote this program to transform quadratic expressions in general form into vertex form. \$ax^2 + bx + c \;=\; a(x-h)^2 + k,\quad\text{where}\quad h = -\frac{b}{2a} \quad\text{and}\quad k = ...
4
votes
0answers
29k views

Python video streaming server and client

Worked with same IP cameras for some time, and noticed that camera use much processing power because of multiple connections. Writing streaming server looked as nice solution so I decided to write my ...
4
votes
2answers
76 views

Python Friendly Form

The 'friendly form' of a number is written as a sum of reciprocals of distinct positive integers. eg. $$\frac{4}{5} = \frac{1}{2} + \frac{1}{4} +\frac{1}{20}$$ I have written a python program that ...
3
votes
1answer
531 views

Web scraping news articles with Beautiful Soup

It's been nearly a year I've been working with C++ and now I am diving in Python and its libraries and frameworks. I am currently creating a website for my portfolio that gathers news articles from a ...
5
votes
1answer
13k views

Finding the multiple of 3 and 5

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both ...
5
votes
1answer
40 views

Recursively listing the content of an FTP server

Today I found myself in need of programmatically getting a recursive list of the files on a remote FTP server to look for some data archives. Much to my surprise, I could not find this functionality ...
18
votes
8answers
3k views

Stack data structure in Python 3

I have implemented a stack in Python 3, and it works well. If anything needs to be improved, I would appreciate the criticism. ...
1
vote
1answer
35 views

Custom String Formatter

I've written my custom implementation of an f"" / .format(...). I started the project thinking it was going to be longer than ...
8
votes
1answer
57 views

Printing Colored, CLId Unicode Chess Board - follow-up

Follow up to: Printing Command Line Unicode Chess Board A couple people from the previous question mentioned looking into coloring the command line with ANSI escape sequences. In Python, ...
4
votes
1answer
28 views

Save points cloud in PLOT3D format

I have the following function to save points cloud in PLOT3D format: ...
5
votes
1answer
83 views

Compiling Go with python

I've made a small script to compile Go code with Python. The result is not something I'm happy with, because: It seems overly complicated I'm worried the nested if-else with f string are unreadable ...
5
votes
1answer
58 views

Turtle controller with simple instruction set

I've made a controller for Python's Turtle. The controller essentially defines an 'instruction set' so that commands can be recorded in a text file and then executed sequentially by the turtle. It ...
6
votes
2answers
78 views

Bubble Sort Implementation in Python 3

I have implemented a Bubble Sort. It works well. But if you think something needs to be improved, say it. This code was tested in Python 3.7.4. ...
5
votes
2answers
85 views

Creating a function with limited number of args in python

I am learning programming, and I am thinking how to improve this code in a more pythonic way. I have a function with number of arguments. However, any caller of the function can specify the arguments,...
1
vote
1answer
47 views

How to check list of environment variable in python? [closed]

I have requirement to check list of environment variable in Linux. Based on environment variable, exit code will be different. how to optimize the below code? ...
2
votes
2answers
44 views

Speed performance of picking unique value from binary matrix file

I wrote this code to read a square matrix saved as binary file, that it can be int, uint, float etc... to pick a value from the matrix at given row ...
5
votes
1answer
58 views

Remove words from an exclude list in each row of a pandas.Series

I am trying to remove all occurrences of the words I collect in the list exclude from every text note. This is my approach. ...
2
votes
1answer
63 views

Pong game in Python with tkinter

This is a pong game I created some time ago, but it doesn't have methods to store scores yet and also might have some bugs. It is also very slow. The code: ...
3
votes
2answers
98 views

Beginner Tic-Tac-Toe in Python

...
12
votes
4answers
1k views

Extraction of value from a dict-tree, given a path of arbitrary length

Problem: We read a complex json-file which grants us a tree in terms of a python "dict of dicts". We're then requested to retrieve a specific path from the tree, represented by a list of elements. The ...
8
votes
1answer
62 views

File(s) encrypter implementation in python

I'm looking for any feedback in order to improve code styling, performance etc. Also I want to make sure that the way I've implemented AES here is actually secure ...
4
votes
1answer
46 views

Python timing optimisation

I'm new in this community and with Python 3! I'm trying to optimize this exercise: We have n strings stored in a txt file. Inside the strings a secret word is ...
3
votes
1answer
89 views

Login system created with Python

This is a program that I created using Python. Please help me optimize the code. ...
19
votes
6answers
4k views

Explicit song lyrics checker

To stay in practice with my Python I've decided to write an explicit song checker. It checks each word in the song against an array of 14 explicit words contained in the text file. I've decided not to ...
5
votes
2answers
270 views

Productivity/Timer app that uses twilio to send SMS-reminders

I wrote a timer app in python using both twilio and the timer module; sends an sms to my phone after a certain amount of time has passed. While it works without a doubt, I wanted to gather some ideas/...