Questions tagged [python-3.x]

Python 3 is the latest version of the Python programming language and was formally released on December 3rd, 2008. Use this tag along with the main python tag to denote programs that are meant to be run on a Python 3 interpreter only. Do not mix this tag with the python-2.x tag.

Filter by
Sorted by
Tagged with
0
votes
0answers
5 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 ...
3
votes
1answer
32 views

Grokking the basics of BlockChain with Python

As I was streaming I had a brilliant visitor suggest we write a blockchain in Python. So we did. Note that there is no validation or voting simulated here. Here's the results, in ...
4
votes
0answers
29 views

Speeding up code to check whether a permutation with one fixed point can be rotated into one with two fixed points

A friend gave me the following riddle: Given n people with n distinct names, you place n names tags on a round table with n seats. If the n people now sit at those seats randomly such that exactly ...
2
votes
1answer
31 views

Instagram Scraping 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 ...
2
votes
1answer
14 views

Join ArcGIS tables in Python of plant greenness in response to prior month's rainfall

I am using Python 3.8 with ArcGIS Pro 2.5. This code creates a joined table where I match values for plant greenness in the current month with rainfall X number of months into the past. Each loop ...
4
votes
3answers
63 views

BFF Word Finder

Inspired by this question on Puzzling.StackExchange, I've decided to write a small python script that determines if a word is a BFF Word. Below are the parameters, solved by Puzzling user Stiv, also ...
4
votes
0answers
29 views

Automatically encrypting text editor

I have written an automatically encrypting text editor (github link). The reasons that I wrote this program instead of using vim + gpg are: It's more convenient than vim + gpg (user only needs to ...
5
votes
1answer
54 views

ROT128 byte-transformation encoding

I'd like some feedback on code I wrote to obfuscate text on-disk. The basic idea is the same as ROT13 (which is implemented in the Python standard library), except instead of rotating the English ...
1
vote
1answer
62 views

Shortest path in Binary Maze

I want a feedback on my code for the below known problem from Daily coding challenge: You are given an M by N matrix consisting of booleans that represents a board. Each True boolean represents a ...
1
vote
1answer
24 views

How to make a customized method for dataframe in my analysis module?

Please download the file and save in home directory and extract it. https://www.dropbox.com/s/swtw8bk35zr1i6d/analyse.7z?dl=0 I can get some warrants info. ...
3
votes
2answers
235 views

Sliding window iteration in Python

I'm creating a small library of Python utilities, and I'd like feedback on a function which allows iterating over an arbitrary iterable in a sliding-window fashion. Relevant parts of ...
3
votes
1answer
68 views

Building optimal portfolios for all combinations of stocks

Hi I recently wrote some code in python that does the following: 1.) Pulls stock closing data from yahoo finance for x number of stock 2.) finds all possible combinations of x stocks in groups of y ...
7
votes
1answer
110 views

Simple antivirus

I wrote a simple antivirus in Python and would love feedback for additional ideas to implement, as well as general code review. So far it has a FileScanner that ...
6
votes
2answers
379 views

Implementing web scraping in a function and in a class

The goal of my code is to implement a web scraping routine to obtain the name and the price of a product. I want to put this routine separated from the main program file. Sample url to scrape: https://...
3
votes
1answer
55 views

Tar archive parser - custom implementation

I'm learning python and for educational purposes I implemented tar archive parser. I'm not beginner programmer. I would like to receive some feedback and tips about code, what can I improve, what ...
0
votes
1answer
59 views

Current python for loop not efficent

I have the following working code ...
1
vote
1answer
111 views

Instagram Bot, selenium, web scraping

I made some changes in my code from the previous post. The changes that I made: I put all the functions to the class All the global arrays I moved them to class too Created ...
1
vote
2answers
76 views

Cleaning HTMLs to extract text

I have written the following routine to clean an html raw code and extract the text. It works, but the code is not very well written. Any ideas how to solve this faster and with fewer lines of code? ...
2
votes
1answer
55 views

Advent of Code 2019 Day 7 (simple emulator, opcode processing)

Since couple of days ago I started to learn python by doing AoC 2019. I would like to share with you my solution to day7 (Amplification Circuit) part 1 and part 2. Challenge summary: --- Day 7: ...
-3
votes
0answers
22 views

Graph creation from ordered list of coordinates [closed]

I have a Python (3.7) question. I've got the following list in a file: 3 30 30 90 60 60 80 10 90 100 0 the 3 is how many coordinates I'll have coming; Each line ...
2
votes
1answer
28 views

Python implementation of Kahn's Algorithm

Please provide any suggestions on the below code for Kahn's algorithm. Can it be implemented in a better manner, or be improved: ...
5
votes
1answer
42 views

Calculate quote volumes (for a financial instrument) within numeric constraints

The function below is part of a trading system. Its purpose is to assign a volume (order size) to a bid (buy) quote and and ask (sell) quote, depending on the value of the ...
5
votes
1answer
56 views

Tarjan's Algorithm Python Implementation

I'm planning to use Tarjan's algorithm for a program in which I would be processing a file, converting the processed data to a dictionary, doing a topological sort on that dictionary (using this ...
2
votes
1answer
55 views

Web scraping using selenium, multiprocessing, InstagramBot

An Instagram Bot which downloads the posts from profile I have to mention my previous posts: Instagram scraper Posts (Videos and Photos) Scraping Instagram with selenium, extract URLs, download ...
3
votes
1answer
72 views

Scraping Instagram with selenium, extract URLs, download posts

I made a very simple Instagram Bot 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: Creating directory for saving ...
2
votes
1answer
24 views

Python Socket programming chat - getting a handle on PEP conventions

A while back I wrote a socket programmed chat in Python. This question isn't really about the program specifically, moreso on conventions of Python and my style of coding. I've only been using Python ...
2
votes
1answer
27 views

Assign multiple values to variables with a function in a class

I would like to use this feature >>> def func(): >>> return 1, 2 >>> x, y = func() But I have a formatting problem, because I want ...
7
votes
1answer
105 views

Find neighbours of a switch using Python and SNMP (LLDP)

INTRO About SNMP SNMP stands for simple network management protocol. It is a way that servers can share information about their current state, and also a channel through which an administer ...
3
votes
1answer
69 views

Python function to fill a list based on index number

I wrote this function to fill a list with object based on the desired index they should have. Here the func: ...
3
votes
1answer
66 views

Reddit Challenge #383 Python

I've completed the Reddit challenge #383. Please find a a summary of the challenge and the test cases below: Reddit Challenge #383 Necklace Matching challenge: In this challenge, we ...
0
votes
1answer
31 views

Python graphical user interface test

In my programming class I am learning how to make graphical user interfaces, and so I decided to make one. ...
3
votes
1answer
42 views

Sequence and Series Solver

I made a sequence and series solver just for helping me solve homework, and I'm in dire need of ways to make it further compact and efficient, since I used brute force. If you want to see what this ...
4
votes
1answer
118 views

Instagram scraper Posts (Videos and Photos)

I wrote this code which has the ability to download images and videos from a specific Instagram profile. Using multiprocessing and threading I managed to speed up the extraction of data. My goal is ...
4
votes
1answer
76 views

Scraping Data From Multiple URLs into Single Dataframe

I have a Class that: goes to a url grabs a link from that page, and a date (filing_date) navigates to the link, and writes the table from that page to a ...
4
votes
1answer
47 views

One consumer and two producers using threads

I have based this code on Producer-Consumer Threading on Real Python. The idea is that I have 2 producers: One producer will give result every 0.4 to 0.7 seconds, depending on REST call. The second ...
6
votes
1answer
949 views

Merging two dictionaries together whilst adding keys but multiplying values

I have two dictionaries and a merged dictionary: dict1 = {-3: 0.3, -2: 0.1, 1: 0.8} dict2 = {0: 0.3, 1: 0.5, -1: 0.7} dict_merged = {} I have code that basically ...
7
votes
1answer
106 views

Pyqt Tic Tac Toe

Recently discovered PyQt5 and decided to make this as a 'hello world' for GUIs Would like input on the design, best practices, as well as idiomatic nature of the application and its structure. Game....
4
votes
1answer
65 views

labelpix, image annotation tool for object detection GUI python

For the full code, please go to https://github.com/emadboctorx/labelpix This is an object detection tool for drawing bounding boxes over images and save output to csv/hdf or yolo (You Only Look Once) ...
17
votes
1answer
2k views

Rock Paper Scissors Lizard Spock

I got some good feedback from the last code I posted which I have incorporated in to this project (enum, try, f string formatting), so again just looking for some feedback on how the code could be ...
4
votes
1answer
66 views

Suffix Tree in Python

I was wondering why the following implementation of a Suffix Tree is 2000 times slower than using a similar data structure in C++ (I tested it using python3, pypy3 and pypy2). I know the bottleneck is ...
3
votes
1answer
42 views

A geometry Sector Solver, Value finder for my calculator's micropython

I made a program for my calculator for A levels that acquires the value of the angle and radius of a sector and gives: Area of Sector Area of inner Triangle Arc Length Chord Area Chord Length Sector ...
3
votes
0answers
47 views

a kinematics(suvat) equation solver for micropython

so i made a python program for my calculator's micro-python that lets you enter a value for any 3 of these variables ...
0
votes
2answers
59 views

Read .csv files and convert the rows into dict for looping

This script tries to parse .csv files and returns an iterable object to fetch one row at a time to do some process. It works fine but I think it needs improvements ...
6
votes
1answer
60 views

Reach certain Wiki page through random links

I just read about Wiki game on Wikipedia and wanted to implement it as a fun project for myself using python. Task:To reach Mathematics Wikipedia page using wikipedia hyperlinks randomly. Using ...
1
vote
1answer
33 views

Recursing function to create dir in python

I am trying to write a small function to safely create dir until dir until full path of file exists. Trying to do it in recursing function and would love to get some feedback ...
8
votes
1answer
109 views

A Python based Tic-Tac-Toe game

As a basic project, I've programmed the game of noughts and crosses (tic-tac-toe) using classes. I made three classes: Board, ...
1
vote
2answers
70 views

Better pythonic way to pass condition to multiple functions [closed]

I have the following scenario where most of my functions require to return different things based on a condition. ...
0
votes
0answers
14 views

Generate a ColumnDataSource for a bokeh histogram hover displaying the names of the units in each bar

I came up with the following setup_cds function as a solution to my own SO question. My question is: how could I improve it (especially the joining of the names ...
1
vote
3answers
50 views

Custom exception handling function or logging library?

I want to document every exception handled in my code and some states of the code when it works properly. What I've done is two functions, one that creates an 'error report' (function: ...
5
votes
1answer
76 views

Efficient implementation of priority queue

I am trying to solve a maze problem. The input data is a matrix, where the individual element represents the height of the mountain in that particular area, I have to start from position (0,0) and go ...

1
2 3 4 5
77