Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

# 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.

3,449 questions
Filter by
Sorted by
Tagged with
63 views

### Project Euler - Problem No.4 - Largest palindrome product

according to the problem: A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made ...
77 views

### Tic-Tac-Toe code using Python with Tkinter

`I made this Tic-Tac-Toe game first, by using user input in the console here: https://pastebin.com/6zLjrWcf , and now new and improved using Tkinter: ...
54 views

...
76 views

### Find the number of pawns available for a rook to capture

I find that very very often with matrix questions, the traversal and comparison part of the solution is very verbose and repetitive. For example, this code (written for a coding challenge) to find ...
2k views

### Raindrops in Python

There's this simple coding challenge that feels like a twist on FizzBuzz. Your task is to convert a number to a string, the contents of which depends on the number's factors. If the number has 3 ...
61 views

### Project Euler - Problem 3

The description of the problem is: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? Here is my solution: ...
42 views

### Short function to remove unnecessary whitespace

I have a function consisting of one line of code: def trimString(string): """ Remove unnecessary whitespace. """ return re.sub('\s+', ' ', string).strip() ...
96 views

### Project Euler # 67 Maximum path sum II (Bottom up) in Python

This is Project Euler #67: Maximum path sum II: By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 ...
30 views

### Return timeframes relevant to just-elapsed time period (financial/trading context)

I am writing trading software, and have written this utility function. Its purpose is to return a list of timeframes relevant to the just-elapsed time period. "Timeframe" here means bar or candle ...
30 views

### Form deserializer for Python Flask

I've started working on a small Flask project for no real reason other than fun, and pulled myself back on form validation. I realize that there are existing libraries like WTForms, but wanted to try ...
123 views

### Python Tkinter login GUI with database

I created a simple login program that works how I wanted them to work. I separated the GUI and database codes into two different python files. I named the files as login.py and dbaseManip.py. The ...
94 views

### Footwear scraper

I've done this parser to scrape all footwear data, but I don't know if it is good to use OOP in this case. Can you please check this out and give me the strongest feedback? I'm working on improving my ...
54 views

### Project Euler # 55 Lychrel numbers in Python

If we take 47, reverse and add, 47 + 74 = 121, which is palindromic. Not all numbers produce palindromes so quickly. For example, 349 + 943 = 1292, 1292 + 2921 = 4213 4213 + 3124 = 7337 That is, ...
98 views

### Project Euler # 54 Poker hands in Python

In the card game poker, a hand consists of five cards and are ranked, from lowest to highest, in the following way: High Card: Highest value card. One Pair: Two cards of the same value. Two Pairs: ...
120 views

### Not so Excellent Knight's Tour

Note: This is part of a set of demo applications I'm writing for colleagues to show we're not limited to VBA when dealing with Excel. Considering our IT challenges (no admin on-site & no local-...
53 views

### Linny: Continued Language Development

A previous question regarding Linny exists here. After a wonderful response on my previous question regarding my developing programming language, I worked on it for a couple days, and am returning ...
67 views

### Updateable Priority Queue

I've implemented an updateable priority queue as a part of implementing some single-source-shortest-path algorithms (Dijkstra, BF). I'm relatively new to Python. ...
37 views

### Consolidating a dictionary from nested dictionary

Currently learning from "LPTHW - Zed Shaw" and "Automating the boring stuff". There is a nested dictionary of the type ...
71 views

### Project Euler # 56 Powerful digit sum in Python

A googol ($10^{100}$) is a massive number: one followed by one-hundred zeros; $100^{100}$ is almost unimaginably large: one followed by two-hundred zeros. Despite their size, the sum of the digits ...
118 views

### Linny: An Interpreted Programming Language

There is a follow up question here. I've undertaken the project of creating my own programming language, Linny. It's a very, very simple language, with only variable creation, variable changing, and ...
1k views

### Determine if a triangle is equilateral, isosceles, or scalene

I've been fiddling around with some easy code challenges and there's one about determining if a triangle is equilateral, isosceles, or scalene. I've come up with a working solution, but I feel this ...
66 views

### Project Euler # 53 Combinatoric selections in Python

There are exactly ten ways of selecting three from five, 12345: 123, 124, 125, 134, 135, 145, 234, 235, 245, and 345 In combinatorics, we use the notation, 5C3=10. In general, nCr = n! / r! (n−r)!, ...
68 views

### Project Euler # 52 Permuted multiples in Python

It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order. Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, ...
81 views

### Determine whether three sides form a valid triangle, and classify the triangle

This is a my first Python program, and whilst I am new to Python I would like to keep in good practice Below is a short program to work out what type a triangle is and if it makes a valid triangle ...
34 views

### Python script to import MySQL tables to PostgreSQL

I'm using the below Python script to port few table data from a remote server (MySQL database) to my data warehouse server (PostgreSQL DB), The script is working fine (I'm using foreign data wrapper), ...
35 views

### Optimising the BFS

The input graph to the bfs function is in the form of edge list representation. ...
48 views

### Traversing two trees until a common value has been found

I am traversing two objects that may share a common ancestor. To make the code small enough to show here, I have changed it into two dictionaries with values. As you can see, ...
32 views

### Invoking parallel threads of a nslookup command in python

I've written below python script just to invoke parallel threads of a command nslookup linux-host01 dns-server, i'm Just trying to flood the DNS Server ...
120 views

### Project Euler # 50 Consecutive prime sum in Python

The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime below one-hundred. The longest sum ...
75 views

### Caesar Cipher Guesser

I've written a Caesar Cipher in python (a more in-depth explanation is provided in the docstring at the top of the program). At first, it was supposed to just be the cipher, but I expanded it to have ...
19 views

### Grouping by on Pandas df with focus on performance

I am doing a group by on a subset of a dataframe. I am working with 9m+ rows atm, subject to sharp increase. I tried different approaches already and wanted to know if i could squeeze a bit more ...
241 views

### Project Euler # 49 Prime permutations in Python

The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual in two ways: (i) each of the three terms are prime, and, (ii) each of the 4-digit numbers are ...
72 views

### Project Euler # 48 Self powers in Python

The series, $1^1 + 2^2 + 3^3 + \ldots + 10^{10} = 10405071317$. Find the last ten digits of the series, $1^1 + 2^2 + 3^3 + \ldots + 1000^{1000}$. ...
48 views

### File compressor

I have written a file compressor in python. The program generates a file filled with sequences of the same character with a random length, and compresses that file. I would like feedback on code ...
68 views

### Grouping sorted coordinates based on proximity to each other

I created an algotrithm that groups a sorted list of coordinates into buckets based on their proximity (30) to one another. Steps: Create a new key with a list ...
89 views

38 views

### Project Euler # 29: Distinct powers in Python

Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5: 2 ** 2 = 4, 2 ** 3 = 8, 2 ** 4 = 16, 2 ** 5 = 32 3 ** 2 = 9, 3 ** 3 = 27, 3 ** 4 = 81, 3 * 5 = 243 4 ** 2 = 16, 4 ** 3 = ...
23 views

### Project Euler # 28: Number spiral diagonals in Python

Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows: ...