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
25
votes
4answers
7k views

Sieve of Eratosthenes - Python

I've been doing a lot of Project Euler lately and just wanted to make sure my implementation was as good as it could be. Does anyone have any suggestions to speed this up? ...
6
votes
3answers
2k views

Efficiency of Project Euler problem 35

The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, ...
15
votes
2answers
6k views

Evaluating arithmetic expressions

I have written some simple code for evaluating expressions. However, I am not sure how well I am following conventions (this is my first time trying to). Specs for problem: All binary operators (+, -...
13
votes
3answers
2k views

AniPop - The anime downloader

Note: The topics of performance and Selenium/BS4 have not yet been addressed, so this question can still receive a better answer! Chat Room: https://chat.stackexchange.com/rooms/100275/anipop-...
4
votes
1answer
171 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 ...
5
votes
2answers
2k views

Generating frequency tables based on CSV dataset

I am working on a project which crunches plain text files (.lst). The name of the file names (fileName) are important because I'...
4
votes
1answer
127 views

Abstract graphing-and-timing functions

I like to use timeit to measure performance of small, and sometimes big, functions. However it can be uncertain as to what the 'actual' time to execute the function ...
5
votes
1answer
157 views

Arabic language lesson program

The program I have been working on has been developed almost exclusively as "train-of-thought" style code. Things happen linearly (for the most part) thru the code. The goal of the program is to house ...
3
votes
1answer
322 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 ...
10
votes
2answers
1k views

CodeFights: Pipes game

Description Carlos always loved playing video games, especially the well-known computer game "Pipes". Today he finally decided to write his own version of the legendary game from scratch. In ...
11
votes
3answers
2k views

RattleHiss (fizzbuzz in python)

This is an iterative review. The previous iteration can be found here. The next iteration can be found here I've now been programming in python for all of 4 hours. At 70 lines it's rather verbose ...
15
votes
3answers
5k views

Number of Islands in a 2d grid

Recently, I've solved this "Number of Islands" problem on LeetCode, the solution was accepted by the LeetCode OJ. Problem Description Given a 2d grid map of '1's (land) and '0's (water), count the ...
12
votes
3answers
2k views

PyDOS shell simulation

I have a big project called 'PyDOS', written in Python 3.4, and it's going very well. Post your answers of anything that could make it look cleaner. ...
10
votes
2answers
20k views

Pretty-print Pascal's triangle

...
3
votes
2answers
217 views

Sequence processing problems

Problem 1: Sum the even numbers for the first n fibonacci numbers Solution: ...
2
votes
1answer
110 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 ...
12
votes
2answers
134 views

“Drone Racer” now shipping in your local area

This question is a follow-up of this one; where I present a software to plan and manage drone races. I might come with a new question about the SQL part in a few days as well. The code can still be ...
12
votes
6answers
4k views

Python 3 - Fibonacci Implementation

I wrote a function returning the n-th Fibonacci number in Python 3: ...
11
votes
2answers
247 views

Segmented wheel Sieve of Eratosthenes in Python

Here is a new version of a segmented and wheel factorized Sieve of Eratosthenes. It currently uses mod 30 wheel factorization to eliminate multiples of 2, 3, and 5 in the sieve data structure to gain ...
9
votes
2answers
879 views

Decoding grayscale PNG and performing Prewitt operator for edge detection

I'm a hobbyist programmer. What I try to do here is to read 8-bit grayscale PNG file. Then unfilter it. (That caused a headache). And after that perform Prewitt operator for "edge detection". I know ...
7
votes
3answers
274 views

SQL Query generator, round 2

This is the second round of reviews. The first round can be found in this question. This is a project I have been working on. This is one of my first experiences with Python and OOP as a whole. I ...
6
votes
2answers
2k views

2 player dice game, where even total gains points and odd total loses points NEA task computer science

This is a game for two users who roll 2 dice 5 times. If the total of dice is even the player gains 10 points if it is odd, they lose 5. If there it is a draw after five rounds then the both users ...
6
votes
1answer
581 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 ...
5
votes
1answer
466 views

Assigning sentiment to each tweet - Twitter trend

Below assignment is taken from here. Introduction In this project, you will develop a geographic visualization of twitter data across the USA. You will need to use dictionaries, lists, and ...
5
votes
1answer
922 views

Python Port Scanner 2.0

A few months ago I put up a port scanner for review. Now, I've updated it with some new Python knowledge and integraing the feedback I got. Some things I specifically think might be wrong with it or ...
3
votes
1answer
162 views

Stable reversed Tartaglia's triangles

Inspired by Minimising the triangle I am writing a fully tested program to solve the following problem: A triangle needs a good foundation. Every row in the triangle is derived from the sum of the ...
3
votes
3answers
4k views

Change filename of Excel-files based on the content of a cell

I have hundreds of Excel-sheets looking something like this: I can't use the actual sheet, and not the exact document numbers, since they are confidential. The name of the files are something like ...
2
votes
1answer
4k views

Return path between graph nodes using depth-first search

This code is meant to implement a Graph class which has a method that returns a path between 2 nodes using depth-first search. I'm doing this to improve my style ...
16
votes
2answers
2k views

ECDH implementation in python

I wrote an implementation of elliptic curve Diffie-Hellman key exchange in python. I would like to know if I could make it faster, cleaner or more secure: ...
14
votes
1answer
2k views

Merge n sorted iterators

Over the weekend I was curious about efficiently merging multiple sorted iterators together, and for them to be in sorted order. This is quite like a challenge on HackerRank: You’re given the ...
11
votes
2answers
1k views

Memoizing decorator that can retry

I have some tasks that I'd like to memoize because they connect to a rather slow network and have to wait for the data. Unfortunately this network can be a little finnicky and we get occasional ...
9
votes
1answer
8k views

Creating truth table from a logical statement

This code creates a truth table from a statement in logic. The statement is input as a string, and it is identified as a tautology if it is true for all true and false combinations of the variables. ...
8
votes
1answer
153 views

Measure time and space requirements of different Python containers

I was actually kind of bored and since I'm studying some Python data structures I decided to make some size(MB) and time(secs) comparisons between different containers when conducting the operation of ...
8
votes
1answer
4k views

Equation parser and solver

I wrote this equation parser and solver, I feel like it is well documented and tested: ...
6
votes
1answer
87 views

Flask application for buying stocks

I wrote three Flask views below. First view input stock code Second view get the stock details (name, price) of the stock by using 3rd party api get the balance cash of DB and show to the view ...
6
votes
1answer
186 views

Web scraper that extracts urls from Amazon and eBay

Description: This is a simple script for scraping Amazon and eBay category, sub-category and product URLs and saving contents to files. In case of previously saved files, the files will be read and no ...
5
votes
1answer
172 views

Arabic language lesson program Part 2

This is the second time I am asking for a review of this code (first time can be found here: Arabic language lesson program). The goal of the program hasn't changed - to house Arabic language lessons ...
5
votes
2answers
6k views

Print initial letter of an entered name

Just started learning python and I'm solving some beginner problems. I wrote a solution for a question without any edge cases like user not entering anything, entering numbers etc.: Question: Write ...
4
votes
1answer
73 views

Back to Basics - Tic Tac Toe

I've seen a few TTT related posts recently, and thought I might learn something or be reminded of certain techniques from attempting my own rendition. Here is that attempt! Hopefully any new coders ...
4
votes
1answer
435 views

Improving time complexity of finding the longest palindrome in Python

The Longest Palindromic Substring challenge from InterviewBit: Given a string S, find the longest palindromic substring in S. where a "substring" must be contiguous, and in case of ties the first ...
3
votes
0answers
2k views

Breadth-first search: traditional and bidirectional in Python - follow-up

I have refactored the version of the previous (and initial) iteration according to the answer by alexwlchan. As a reminder, this snippet compares breadth-first search against its bidirectional variant....
3
votes
0answers
68 views

Simple General Purpose Parser Implementation

This is an implementation of a general Purpose Parser/Matcher that can operate on any input stream of objects and will return all possible combinations. In this case I do not value performance that ...
3
votes
1answer
132 views

Python3 Stack implementation with List built-in - Round Two

Previous code is available at Python3 Stack implementation with List built-in, this is a second-round review after I made alterations. Once again, let's review my Stack implementation, with built-in ...
2
votes
1answer
146 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 ...
2
votes
1answer
288 views

Multifunction sprite class for pygame

I've written a class that allows me to easily create sprites on the screen, and then do things like: setting an image or an animation; move the sprite as a platformer or as a top down game; and test ...
1
vote
1answer
114 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 ...
1
vote
1answer
148 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
1answer
88 views

Project Euler 34 # Digit Factorials in Python

145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. Find the sum of all numbers which are equal to the sum of the factorial of their digits. Note: as 1! = 1 and 2! = 2 are not ...
-1
votes
2answers
3k views

Filter a list with given predicate - python [closed]

For the following question, the function • should mutate the original list • should NOT create any new lists • should NOT return anything Function that do not create new lists are ...
13
votes
4answers
26k views

Simple text RPG in Python

I am trying to teach myself to code using Python. The following is the first real program I have written from scratch. I feel that it is messy and in need of improvement, but I am either unsure of ...

1
2 3 4 5
8