As of May 31, 2023, we have updated our Code of Conduct.

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
1 answer
123 views

Text based naval game

here is the second game I have made. its not easy and I was hoping someone could test it and bring some improvements to the table. fun project for learning. ...
codec's user avatar
  • 27
3 votes
1 answer
63 views

World Weather Application in Python using tkinter

I have developed a World Weather application using Tkinter in Python. The application retrieves current weather information and a 3-day weather forecast from the Weatherbit.io API based on user input. ...
Paichiwo's user avatar
  • 101
1 vote
2 answers
109 views

Python program that deals with overlapping intervals

This is related to my previous question, this is the core logic of that script that I wanted you to review. Basically, I have two very large lists collectively ...
Ξένη Γήινος's user avatar
3 votes
1 answer
71 views

Python command line password generator

After giving a couple of well-received answers to similar questions, I thought I'd try to come up with my own solution. I believe that a good password generator can and should be quite simple without ...
gazoh's user avatar
  • 2,552
2 votes
1 answer
109 views

ANN with Backpropagation for MINST data set

I am learning about ANN and tried it for the MINST data sets. Now I am supposted to create a neural network (ANN) with backpropagation. The structure for the neural network I have is this the input ...
zellez's user avatar
  • 47
2 votes
0 answers
105 views

Truly cryptographically secure password generator in Python, version 2

Following suggestions from answers from my previous question, I have completely rewrote my script, to make it more concise and Pythonic, truly cryptographically secure, and added more functionality. ...
Ξένη Γήινος's user avatar
9 votes
3 answers
1k views

Python command-line program that generates passwords

I took my code from this answer by me, I found it useful, so I developed it further, and here is the result. This script generates cryptographically secure passwords. The characters used by the ...
Ξένη Γήινος's user avatar
-1 votes
1 answer
34 views

methods for updating and validating screenshots [closed]

I have a couple of methods and I am wondering if I can write them better. I am in dilemma of choosing over keeping all the functionalities in one place used by one method and dividing into multiple ...
ParthS007's user avatar
  • 207
7 votes
1 answer
460 views

Function to flatten nested iterables but not some excepted types

I wrote this function to flatten nested iterables (with arbitrary depth) but refrain from flattening excepted types (for instance, string or ...
VBobCat's user avatar
  • 307
-4 votes
0 answers
48 views

The IDE I made in python (IDE-A)

IDE-A is a simple python code editor I will not write much as I have separated files needed for main to run so I will leave github link for review. I am interested what problems will show up. Please ...
some_dude's user avatar
2 votes
2 answers
108 views

Python data class that is a mixture of dict and namedtuple

I wanted to create a data class that is strongly typed, and behaves both like a namedtuple and dict. It should check the data ...
Ξένη Γήινος's user avatar
1 vote
2 answers
84 views

PDF invoices from user input

Firstly the goal of this code is a little more complex than in this post and the other invoice questions are C# Is there anything that just pops out as immeadiately unpythonic/wrong ? I have a few ...
Lozminda's user avatar
1 vote
0 answers
56 views

Python script that turns a gigantic text file into an IP geolocation database

I have written a Python script that turns a gigantic text file into a SQLite3 database. The text file is truly gigantic, it is 133MiB or 140,371,572 bytes in size, and contains 140,371,572 characters ...
Ξένη Γήινος's user avatar
0 votes
0 answers
16 views

Multiple classes getting the output of a parallel process performing heavy computations

I have a python script with different classes performing various tasks. There is one class that performs heavy computations that are needed by other classes. I am using multiprocessing in order to do ...
firion's user avatar
  • 111
2 votes
1 answer
53 views

filling the array with a spiral [closed]

I need to fill an array with a spiral, using two variables: height and length. I guess I've written good code but I'd like to get some advice about anyway. The main problem is exceeding time limit and ...
user avatar
8 votes
2 answers
1k views

Checking if a chessboard presented as a dictionary, is a valid chessboard

Here's my solution to the Chess Dictionary Validator project in Automate the boring stuff by Al Sweigart. I'd love to know how I can improve this code so that it's more efficient. Thank you Function ...
Nova's user avatar
  • 113
3 votes
1 answer
51 views

A Python decorator to trace function calls

A while ago, I came up with a function that is similar to this one: Decorator to log function calls and return values, but with a different implementation. What this function does: when applied to a ...
Kate's user avatar
  • 5,944
16 votes
6 answers
4k views

Write a program that asks the user to input 10 integers, and then prints the largest odd number that was entered

I am mechanical engineer and have started learning Python from a book called 'Introduction to Computation and Programming Using Python' by John V. Guttag. This is one of the examples. I know that ...
Shreeyash Motiwale's user avatar
1 vote
0 answers
41 views

Decorator to log function calls and return values

I want to write a decorator in Python 3.11 that adds some basic logging to functions. I want to use the decorator without any keyword arguments: @add_logging In ...
uli's user avatar
  • 11
3 votes
1 answer
198 views

Find pairs that concatenate to a given value

I was doing a CodeSignal coding assessment and run into the following problem: You are given an array of positive integers, and a positive integer x. Your task is to find the number of ways that x can ...
João Gabriel's user avatar
0 votes
0 answers
27 views

Python script to read an XML file and write some information to an Excel file

I'm getting an XML file from an application, want to extract some information from that file and write it to an Excel file. The XML file contains data about vacations. I need data from the last month ...
Jens Kubieziel's user avatar
5 votes
1 answer
156 views

Python script that identifies the country code of a given IP address

This is a Python script I wrote to identify the country code of a given IP address, using data obtained from tor. It uses geoip.txt to identify country code for IPv4 addresses, and geoip6.txt to do so ...
Ξένη Γήινος's user avatar
0 votes
1 answer
65 views

Password keeper / generator application in Python

I've written this password-keeper application to keep my passwords safe in one place. From something over few lines it grew to almost 200 lines of code. I would greatly appreciate it if someone could ...
Paichiwo's user avatar
  • 101
1 vote
1 answer
72 views

Version 2 of my Python Password Manager

I am still just starting out with python and just finished learning about classes, with no further understanding on many python modules. With this in mind, this is one of the biggest/hardest things I ...
Beginner's user avatar
  • 129
2 votes
1 answer
82 views

Turtle language parser in python 3

I a creating a program to parse a simple language in a text file and delegate those actions to python-turtle. You pass the path to the file(s) you want to be parsed into the program, and a turtle ...
sbottingota's user avatar
5 votes
1 answer
51 views

Script to access API and print formatted report to stdout

I work for a non-profit that runs acoustic music camps for adults. This script queries the API for Regfox, the event registration software we use, and prints for each camp a table showing the number ...
Pete Kelly's user avatar
4 votes
2 answers
222 views

Solving The Travelling Salesman Problem Using Genetic Algorithm

I was looking to learn about AI and found the traveling salesman problem very interesting. I also wanted to learn about genetic algorithms, so it was a fantastic combo. To clarify, this is my second ...
zellez's user avatar
  • 47
7 votes
1 answer
78 views

Any advice for my HANGMAN game with PySimpleGUI?

Could you please tell me if there's anything I could improve in my Hangman Game ? I made this Hangman Game in PyCharm and been improving and adding features for some time. It would be nice if someone ...
Paichiwo's user avatar
  • 101
4 votes
4 answers
679 views

Matching words from a text with a big list of keywords in Python

I implemented the following code to retrieve medication names from a given text (prescription_text in the code). It works by matching words in the text with a list ...
cuzureau's user avatar
  • 181
4 votes
1 answer
154 views

Python script to check network speed

This is a Python script I wrote to check internet download speed and upload speed. I wrote this because I live in China behind the GFW, and I use VPNs to browse international free internet, and my ISP ...
Ξένη Γήινος's user avatar
4 votes
1 answer
103 views

Simple encryption/decryption program using python (and tkinter)

I am creating a simple program with a GUI to encrypt/decrypt text using different ciphers. I tried to make it so that it would be easy to add new ciphers. This is my code: ...
sbottingota's user avatar
1 vote
0 answers
142 views

MVVM using Python's tkinter

My task is to change the architecture of a previously written application to Model-View-ViewModel and use the Command pattern. It is written in Python 3.10.6 and uses the tkinter library for the GUI. ...
broland's user avatar
  • 11
2 votes
0 answers
61 views

Python script that refreshes network connection at random intervals

This is a followup to Python script that reboots the router every 600 seconds. Recently censorship in China has increased because of the meeting of heads of states, and my previous script has been ...
Ξένη Γήινος's user avatar
7 votes
4 answers
410 views

Separating a String of Text into Separate Words in Python

Occasionally, we want to do a rudimentary parsing on English text; we separate the text into separate words. ...
Samuel Muldoon's user avatar
2 votes
0 answers
49 views

Pane. A minimal site specific Browser

Here is the code. It takes an argument with the -l flag for a link otherwise it goes to a hard coded search engine (I have selected brave to be different). I'm ...
Andrew Davidson's user avatar
0 votes
1 answer
95 views

Drawing a tilemap using python and pygame

I am creating a tile-map in python using pygame. The code I have (see below) works OK, but I was wandering if there were any ...
sbottingota's user avatar
0 votes
1 answer
24 views

Mangle words to bytearray of lo/hibytes

I would like to refactor the following code snippet adapted from a project I'm involved. It is part of a code to control power outlets via network. The code snippet was written by myself based on the ...
Looser User's user avatar
12 votes
4 answers
1k views

Python script that reboots the router every 600 seconds

This is a Python script I wrote to reboot the router every 600 seconds. Why did I do it? Well, in case you don't know, I live in China, and I use VPNs to browse the international internet. My ISP ...
Ξένη Γήινος's user avatar
2 votes
1 answer
69 views

Game of life(random generation, pygame)

I recently created game about life in python. First version of code was console, but recently I rewrote this game in pygame. I decied upgrade game and was added age of cells. But now I can see that my ...
Максим's user avatar
6 votes
2 answers
2k views

Game of life(random generation)

I wrote a simple game using python, but I wonder: how I can improve it? Any opinions will be useful. I thought about optimization, since the program consumes 20% processor resources, but don't know ...
Максим's user avatar
1 vote
3 answers
183 views

Getting and setting dict items via paths

I wanted to have something more convenient to work with nested dictionaries that come from yaml files so I wrote this ...
t3chb0t's user avatar
  • 44k
0 votes
0 answers
44 views

Generate INSERTs from function parameters with jinja2

I'm writing unit-tests with pytest for sqlite database and reporting functions and I need to arrange them by inserting minimal ...
t3chb0t's user avatar
  • 44k
1 vote
1 answer
67 views

Protecting functions from empty DataFrames

Pandas likes to throw cryptic errors when you feed its functions with empty DataFrames saying nothing that would help you to identify the root cause. In order to ...
t3chb0t's user avatar
  • 44k
1 vote
1 answer
93 views

Mapping pandas' Series to dataclasses

I've got something really simple this time where I'm mapping pandas' Series to dataclasses with a oneliner helper function (as ...
t3chb0t's user avatar
  • 44k
1 vote
1 answer
53 views

Rewritten Python script to split Insyde H2O firmware files

I’ve recently tried to update my Lenovo laptop’s firmware without installing Windows. I haven’t done it yet, but during their research someone on Matrix linked me to this page (original source, ...
schuelermine's user avatar
0 votes
1 answer
34 views

Function to return a file name from lists/dictionary constants

I'm reworking a set of two functions that return a text file name, constructed from a string argument and string variables from a module called inventory. It seems ...
Dan's user avatar
  • 229
-1 votes
1 answer
62 views

Graph function in console

I created a program for drawing graphs of functions and want to hear ideas on "how to improve this program", because I'm only starting to write programs in Python. Would be very good to hear ...
Максим's user avatar
0 votes
0 answers
15 views

custom IoU loss for object detection training in Tensorflow2

I am training a single-class object detection model in Tensorflow/Keras. The input image can contain either 0 or 1 instances of the object of interest (no multiple bounding boxes). My model outputs ...
firion's user avatar
  • 111
3 votes
1 answer
53 views

Cancelling function execution with a ContinuationError

Although throwing excptions for control flow is a controversial topic there are some quite popular examples of using this anti-pattern like C#'s async routines throwing the ...
t3chb0t's user avatar
  • 44k
2 votes
1 answer
27 views

Convert sorted list to BST

I am working on a Daily Coding Challenge to convert a sorted singly-linked list into a binary search tree. We are given the head of the list; the definitions of ...
Arya Singh's user avatar

1
2 3 4 5
106