Python 3 is the latest version of the Python programming language and was formally released on December 3rd, 2008.

learn more… | top users | synonyms (1)

0
votes
0answers
3 views

Locating a sequence in a sorted array

I read the following question : Searching an element in a sorted array and I thought that I could give it a try in python. Given a sorted list of integers and an integer. Return the (index) bounds of ...
1
vote
0answers
9 views

Finding the date from “2nd Friday of X month”-style input

I've been working through some puzzles from exercism.io. Current puzzle asks me to return a date() from input that essentially says "The 3rd Friday of December" or ...
-2
votes
0answers
17 views

Creating lingo game using python [on hold]

have to create this lingo game using python. Here are the requirements In a game of Lingo, there is a hidden word, five characters long. The object of the game is to find this word by guessing, and ...
1
vote
2answers
41 views

Scraping and using JSON data from thousands of files in a directory

I have a few thousand json files containing order histories sitting in a directory from one of our systems. Since customers can opt in to receive marketing I'm opening each json file and then ...
4
votes
1answer
19 views

DuckyScript precompiler for Arduino Leonardo

I've made a python program to convert DuckyScript code to Arduino code for Leonardo boards. Below you can find both the project files and a sample script. ...
4
votes
4answers
224 views

Merge two list and discarding duplicates

I am trying to implement a function that merges two ordered lists into a third (ordered) one, but duplicates have to be discarded (basically the last step of a mergesort). I think that this code can ...
2
votes
2answers
63 views

IRC logging bot

I've recently been learning Python and decided to write an IRC bot as a good first project. Before now I've only really written scripts. I am using the Python IRC library. The IRC bot joins an IRC ...
4
votes
2answers
137 views

Simple data entry form that writes data to textfile

I made a data entry form that writes each category into a text file. As an example I used Regular, Premium and Diesel categories. They each have open, delivery, total, sales and close numbers for that ...
2
votes
1answer
79 views

Inversion count via divide and conquer

I'm happy to hear thoughts and ideas on structure/performance/testing/whatever and multi-threading, which I haven't gotten into yet with Python. Full code here. Assignment file and a test file ...
-2
votes
0answers
18 views

Calculating average using a loop [closed]

For my homework I need to create a program that calculates a students average for 3 tests, and the total average of the class. I have to do this by using a single user input to gather their names, and ...
-3
votes
0answers
30 views

optimize python3 code in competitive programming [closed]

the following codes from python3 and C++ do the same job ...
8
votes
2answers
418 views

Tic Tic Tic Tac Tac Tac Toe Toe Toe

I created a Tic_Tac_Toe class to play the game Tic Tac Toe. Is there a better way of coding a game like this? I started learning python 5 days ago and my knowledge ...
2
votes
0answers
43 views

Compute the box covering on a graph using CPython

Edit: My initial idea was to use numpy to solve efficiently this problem but after trying without results, someone comment on stackoverflow: "Numpy can speed things up a lot IF your problem is ...
2
votes
2answers
57 views

Project Euler #85: Find the rectangular grid with closest to 2M rectangles

For one place that I interviewed at (for a Python developer position) I worked with one of the devs on two Project Euler problems, one being problem 85. We talked through different approaches and came ...
5
votes
2answers
95 views

Project Euler problem 79: deducing a passcode

For one place that I interviewed at (for a Python developer position) I worked with one of the devs on two Project Euler problems, one being problem 79. We talked through different approaches and came ...
3
votes
2answers
40 views

Beeping Alarm Function

I'm trying to create an alarm function with Python3. The below code does work but it doesn't seem like this is the most optimal way of achieving something like this. Is there a more pythonic way? ...
5
votes
2answers
56 views

Mandelbrot Set Fractal

I thought I would give this months community challenge a try. This is my first time using Python. It does take quite a while to run and it's not very colourful but it works. ...
7
votes
3answers
267 views

Shrinking and expanding square

I'm a computer science student who's just starting out with algorithms and their implementation. I wrote this code for a dynamically morphing square. I was wondering if I could get a review on it. I ...
3
votes
2answers
44 views

Caesar Encryption Tool

I'm newbie in Python and I wrote a tool called Caesar Encryption Tool. At the moment it only encrypts. It takes a plain text and a key from the user then encrypts the plain text using the key. How can ...
4
votes
2answers
53 views

Strand Sort in Python

After reading about Strand Sort on Wikipedia and testing the provided Python version, I decided to try my hand at a faster implementation. I've studied the "Time Complexity" page, read many different ...
6
votes
3answers
91 views

Simple interpreter for a golfing language

This is the seconds version of an interpreter yesterday. It's supposed to be used for code golf, but it currently can't do much. ...
2
votes
3answers
46 views

App for a tabletop RP that generates hits and misses for weapons

I'm looking for tips on cleaning this up. I think it's legible, but it sure ain't pretty. In particular, I'd love to clean up the hitCheck function. I've dealt with ...
2
votes
2answers
35 views

Member function to turn class into dict

I'm working on a project where I often want to turn class instances into dictionaries to write them to MongoDB. I'd like some feedback on the following: ...
2
votes
1answer
48 views

Very simple interpreter

I created a very simple interpreter in Python. It's capable of doing basic math (unfortunately with only two numbers), creating quines and printing text. ...
-1
votes
0answers
50 views

Returning the range of a number as a palindrome [migrated]

I like to do programming challenges in my free time to teach myself and keep fresh, this one I can't seem to optimize though and it's driving me insane. The goal is essentially, "Given a number, ...
2
votes
1answer
51 views

Implementing a Trie in Python - follow-up

This is a follow-up of Wikipedia Trie pseudocode in Python Code quality improvements find has been fixed and a regression test ("bana" vs "banana") has been ...
1
vote
4answers
119 views

Generating arithmetic quiz questions

I have created a quiz in Python that will generate a series of 10 questions to test the basic arithmetic skills of primary school children. To do this, I have used a while loop and random functions to ...
2
votes
0answers
50 views

A web crawler for scraping images from stock photo websites

I created a web crawler that uses beautiful soup to crawl images from a website and scrape them to a database. in order to use it you have to create a class that inherits from Crawler and implements 4 ...
6
votes
2answers
154 views

Rock Paper Scissors game in Python

I'm new to programming and I'm trying to teach myself Python through some online books. One of the exercises has me making a Rock Paper Scissors game. The one I have written works well enough I ...
6
votes
2answers
74 views

Parsing mathematical expressions in Reverse Polish Notation

I've wanted to make a calculator for a long time now, so I wrote one of my first parsers, where the input is in reverse polish notation, \$1 \ 1 +\$ becomes \$2\$. It supports to following operators; ...
6
votes
2answers
59 views

Wikipedia Trie pseudocode in Python

I translated the Wikipedia pseudo-code into Python code (little changes only were required), but I do not like the end result, as it looks like C with all those while loops and counters. The fact is ...
3
votes
1answer
49 views

Web crawlers for three image sites

I'm very new to python and only vaguely remember OOP from doing some Java a few years ago so I don't know what the best way to do this is. I've build a bunch of classes that represent a crawler that ...
2
votes
1answer
52 views

TCP server with user accounts, connection threading, and groups/permissions

This is a TCP server I am currently working on. It is accessed through telnet (I know it isn't secure, its just a project for uni). The server is programmed in Python 3. I am currently trying to ...
3
votes
1answer
36 views

“ACM ICPC Team” challenge

I'm attempting this question on HackerRank, which states the follows: You are given a list of \$N\$ people who are attending ACM-ICPC World Finals. Each of them are either well versed in a topic ...
5
votes
2answers
273 views

FizzBuzz for CodeEval

I'm a beginner programmer and decided to try some coding challenges. I found CodeEval and attempted the first challenge, FizzBuzz. However upon submitting my code I found that my submission only ...
5
votes
1answer
67 views

Simple Python + Gtk.Window

I'm learning Python and Gtk so I decided to write a simple application that will take some image let user annotate with a pen and send results through email or save to a file. So far I have the ...
7
votes
2answers
68 views

Strict types decorator (works only with Python 3.5)

I wrote a decorator which makes Python 3.5 raise exceptions if the arguments that are passed to a type-hinted function are of the wrong type. ...
7
votes
2answers
148 views

Factoring Polynomials Completely

I am relativly new to Python and I decided to try to write code that would factor any polynomial using the Rational Root Theorem and synthetic division. I have two questions. Is there any way I can ...
3
votes
2answers
51 views

Project Euler #18: Maximum path sum I

Problem I want to receive advice on my code, which takes 0.012 seconds. ...
1
vote
2answers
99 views

Roll the die… play again?

Is there a way to write this code more efficiently so that it is easier to read, maybe using loops and lists? ...
3
votes
1answer
95 views

Project Euler #14: Longest Collatz sequence

Problem : source Which starting number, under one million, produces the longest chain? n → n/2 (n is even) n → 3n + 1 (n is odd) I want to receive advice on my code. It is too slow... It ...
1
vote
1answer
36 views

Project Euler #12: Highly divisible triangular number

I want to receive advice on my code. It is too slow... The problem I am trying to solve is: What is the value of the first triangle number to have over five hundred divisors? ...
2
votes
1answer
48 views

Dead-end filling maze solver in Python

I was reading Wikipedia about maze-algorithms, and I decided to write my own maze-solver. It uses dead-end-filling as it seemed simple to implement (it seemed, I said). The code I wrote is pretty ...
12
votes
1answer
307 views

Cactus Reborn - A game engine for text-based adventure games

I'm currently working on reincarnation of the Cactus project, Cactus Reborn, and I've gotten the basic implementation so far. At this point, you can create simple, playable games. There are currently ...
5
votes
1answer
68 views

Notifying if a plane has been found

The object is to notify if a plane was found or not. The aircraft_identifier variable is a must. cpl_id and ...
3
votes
2answers
209 views

“Guess number” game in Python

What could I improve on this code? ...
2
votes
1answer
70 views

Tic Tac Toe Player written in Python

I am posting this as a follow up to the Tic Tac Toe class in Python question. I have made extensive changes and rearchitected the code. I now have a board class, a ...
4
votes
1answer
43 views

Words in text counter

This accepts text and returns a list of all words which occur with a required frequency (default frequency is 2). It works well, but gets too slow with large texts, more than 1M words. Where can this ...
26
votes
4answers
4k views

Beheading of knights, who survives?

We have a round table of n knights, where n is some positive integer. These have failed to satisfy the expectations of the ...
17
votes
4answers
2k views

My first calculator

I've just wrote my first code, which is basically a calculator. Please rate it and suggest improvements (keeping in mind that I'm a beginner). ...