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

Find only one subset sum with a specified value in python for large sets

how can I optimize my code for a large set (10000 elements)? ...
4
votes
1answer
60 views

“Wraith” client (RAT) performance

I'm working on a Remote Admin Tool (nicknamed Wraith) which works over HTTP. The code is ugly so far but I'm mainly worried about performance and robustness. Can anyone offer any suggestions as to ...
-3
votes
3answers
68 views

Opinion on Python exceptions? [closed]

Just looking for opinions on which is the best way to use exceptions? Should the exception handling go inside the function or should it go outside the function when you actually call the function. ...
10
votes
2answers
1k views

Perform a Caesar Cipher Shift on a given string

I'd like feedback on my solution to the outlined programming challenge (medium level). I've tried it fast in any way I know how to, but, what might be a more efficient and/or pythonic solution? [...
-1
votes
3answers
130 views

What is the best practice between second assignment or dict's value call?

I want to store a value in a dict (to behave like a cache) but I care about performances. I wonder if it is better to create a second variable in order to store the result of the sum compared to ...
3
votes
1answer
79 views

Find the smallest number of perfect squares that sum to a target

Given a positive integer n, find the smallest number of perfect squares (for example, 1, 4, 9, 16, ...) that sum to n. ...
2
votes
0answers
86 views

Multi-threaded image convolution/pooling-python

This multi-threaded code takes an array of 3d images and applies the convolution function with padding, stride, pad values .. as parameters and same applies for creating pooling layers. I need ...
3
votes
2answers
363 views

Permutations with replacement in Python

Many a times, I've had the need to use a permutations with replacement function. So, I've written a function to do just that: ...
-2
votes
1answer
69 views

Python linter vs PEP8 [closed]

I am working on a Nagios Scraper in Python3. I have Github set to automatically run checks (i.e. Python Linter) to make sure the code is good. It is currently failing that check, although the code ...
3
votes
2answers
87 views

The Dark Dungeon: Narrative game for Python

This is a project I've been working on and it's my first, so please feel free to just copy this into python and give this a try. Below you'll find the main code and a small bit on rules and how to ...
1
vote
1answer
60 views

Simple sorting algorithm speed

I was working on an assignment in my Python class to sort 10 numbers but I wanted to be able to sort any set of numbers be it large or small. The assignment didn't really cover any sorting algorithms ...
1
vote
1answer
79 views

String constructible from short list of words? AtCoder ABC049C - Daydream [closed]

I am practicing python, and in order to brush up my skill, I am trying the programming contest site AtCoder's past problems. Daydream Basically, you are given an input string and have to output YES ...
1
vote
1answer
71 views

Smallest expression within brackets

I would like to know if this is a good approach to finding out all the expressions within brackets. (I was actually asked to find out the smallest bracket expression, I have omitted the function to ...
2
votes
2answers
85 views

Iterative “post order” tree traversal [closed]

I wanted to get feedback on the correctness and efficiency of this post order traversal routine that my wife and I find really easy to grasp. ...
5
votes
2answers
131 views

Loop through group and difference lags

I have time-series data (t) that I want to loop through each t and take the difference of the previous five lags ...
2
votes
0answers
60 views

Pythonic way to cast a dictionary into a pd.DataFrame with two columns?

I have a dictionary where for each key, a single value is stored. Say import pandas as pd dd = {'Alice': 40, 'Bob': 50, 'Charlie': 35} Now, I want to ...
3
votes
1answer
86 views

Find and return the earliest occurring word from a string which contains the most repeating letters

I'd like feedback on my solution to the outlined programming challenge (medium level). I've tried it fast in any way I know how to, but, what might be a more efficient and/or pythonic solution? [...
3
votes
1answer
52 views

Get data from pipedrive API and insert it into Snowflake

I am a new python programmer. I have created the code to put API data from pipedrive to Snowflake database. Here are the steps in my code. Delete the csv file if it exists. Make an API call put all ...
5
votes
2answers
82 views

Simpler Poker Counter

This is a simple poker counter. It lets players decide their actions and makes the currency calculations for them. While adding a bit of console animation. Can I achieve the same results with ...
1
vote
1answer
52 views

File handling with try and except [closed]

I am learning programming with Python. I am not sure if I can write a try/except block like this. ...
5
votes
2answers
85 views

Converting a 1D list to a 2D table

A few days ago someone asked this question. But they quickly deleted the post offering no solution. Given: ...
4
votes
1answer
74 views

Check existence of user identification number

I was tasked with writing a python script to check if a passed ID number exists within a file. The file I was give contains roughly 25,000 unique ID numbers. An ID number is a unique 9 digit number. ...
9
votes
1answer
121 views

Object oriented python

I am starting my adventure with Python and object oriented programming. I wrote a script for salting and hashing password. My main goal is practice with OOP, not cryptography. I know there is no ...
3
votes
1answer
85 views

Run length encoding of an input string (Coderbyte 'Run Length' challenge)

I'd like feedback on my solution to the outlined (medium level) programming challenge. What might be a more efficient or Pythonic solution? The challenge as outlined by Coderbyte: [Run Length] (...
4
votes
1answer
51 views

Wrapper class for mediainfo

I made the following wrapper for the mediainfo command line. I did this mainly because mediainfo gives me more information than ...
6
votes
2answers
217 views

Coloring weekdays with enums

My aim is to assign a color to each workday in a week. So if a user enters a day as a str, then I can know which color it should have. Because colors and workdays ...
4
votes
0answers
62 views

Interacting with PostgreSQL attachment and the file system

I have just migrated from Python 2 to Python 3. I have written the following script to fetch all records of a table, ir_attachment, from PostgreSQL. After fetching all the records I check following ...
6
votes
3answers
110 views

Python Display Streamlining

I have designed a basic interface for a smart mirror I made. I coded it to include the time, date, and several phrases that refresh every 24 hours. The phrases are just some random quotes as examples. ...
1
vote
0answers
56 views

Python Kivy code working Poorly

I've written a MP3 tag editor, using Kivy and Python but since last virtual environment build my code ui is working very poorly. The UI responds very slowly (almost 10 seconds to reflect any action) ...
4
votes
0answers
15 views

Monitored parallel mapping across a Pandas dataframe

This code maps a function over a dataset in parallel in a monitored fashion, and returns the result in the variable out. ...
3
votes
1answer
66 views

Generate random ids from specific numbers of auto generated unique ids

I have this class to generate unique ids and random ids from those unique ids. For the unique ids, it's a sequence of numbers between (start number = given number [start_seed]/or random number (0:...
0
votes
1answer
45 views

Tic-Tac-Toe game suggestion

I am a beginner so please keep it in mind while answering! For player vs CPU is there any more effective way to make CPU better ?? ...
7
votes
2answers
121 views

Pythonic attempt at conversion of length

I'm trying to learn Python, so I started with a program to convert length units, mixing imperial and metric. First I wrote a bunch of small simple functions, but then I wanted to solve the issue of ...
2
votes
0answers
83 views

Given an integer array A and a range, find a subarray within the range with a minimum sum

Problem HackerRank Range query: You are given an array A of n integers. You have to perform ...
2
votes
1answer
64 views

Python Basic Calculator

Hello I made this calculator in Python, I know it's pretty basic but I want your opinions if I made it well or not, and if you find any mistakes or not. P.S ( I know I could do another better than ...
0
votes
3answers
316 views

Count common factors

I have written some code for calculating a count of common factors. Please help me remove anything unnecessary and shorten it. Please tell me if any function in Python 3 can calculate common factors ...
4
votes
1answer
62 views

Python aiohttp extension

I made my first open-source project and wonder if I could do it better. I'll give briefly description, ask some questions and then post whole code. Open to any opinons and suggestions, thank you. So,...
3
votes
1answer
54 views

Inversionless Lenstra ECM running way slower than it should

So I was coding Inversionless ECM using Prime Numbers: A computational perspective and when I finished and tried running my program it ran way, way slower than it is supposed to. I have no idea what I ...
0
votes
2answers
67 views

Optimising code to calculate scores for a set of templates Python

I have a set of code that calculates how well a templates fits a users details. It's kind of long, so I've cut out all the code that does it's job well and only included the bottle neck and ...
0
votes
2answers
72 views

Descriptor to restrict input [closed]

We start off we the following Person class: ...
1
vote
1answer
27 views

Simple Nagios Scraper - version 2

Version 1 - Beginner web scraper for Nagios Current version changes: Moved NAGIOS_DATA dictionary to separate file (and added to .gitignore) Used functions with ...
2
votes
0answers
79 views

Multi-threaded HD Image classifier using a neural network

This is a follow up to the code found here: Multithreaded HD Image Processing + Logistic reg. Classifier + Visualization Description: This code takes a label and a folder path of subfolders as ...
3
votes
0answers
38 views

Python3 output based on input [duplicate]

I have written this code and I wonder if there is a better way to do absolutely any of it. Also, if there is any way to optimise it or if there is a problem please also tell me preferably with fixed ...
7
votes
1answer
72 views

Script to automate image searching and clicking on screen

For testing purposes of a platform I'm working on, I must automate the process of initiating Dota 2, accepting an invite that shows on screen, choose the right spot for that player (team A or team B), ...
18
votes
3answers
3k views

Providing advice based on user's favourite YouTuber

I have written this code which provides advice based on user's favourite YouTuber. I wonder if there is a better way to do absolutely any of it. Also, if there is any way to optimise it or if there is ...
5
votes
0answers
51 views

Dealing Synchronous Request in Asynchronous Code

Problem I am trying to convert my synchronous code to an asynchronous implementation. Using aiohttp I was able to almost get where I want. My problem is how to ...
2
votes
0answers
45 views

Suggestions on how to update equation?

After discovering Float Toy, my goal was to create my own version using Python and Tkinter. The results of the endeavor is shown below. Most of the functionality is complete, but the ...
4
votes
1answer
75 views

Beginner web scraper for Nagios

I am attempting to learn Python. It was suggested to me to try a web scraper, so I thought to get myself to look at multiple Nagios instances. I have not programmed in Python before, but learned from ...
2
votes
0answers
46 views

Web scraping code using selenium and Python

I have a code to scrap data from webpage using selenium and python. The code selects a URL the database and search it using selenium chrome driver and fetches the result and insert into a postgreSQL ...
7
votes
2answers
173 views

Find the closest enemy in a 2D grid with wrapping allowed

I'd like feedback on my solution to the outlined programming challenge. Is numpy a good candidate module for this? What might be a more efficient or Pythonic solution? Closest Enemy II Have ...

1
5 6
7
8 9
81