Python 3 is the latest version of the Python programming language and was formally released on December 3rd, 2008.
3
votes
2answers
34 views
Multiplication Grid function
I've made a small function to output a multiplication grid (those things from primary school! :P) to an inputted number.
...
-2
votes
0answers
12 views
Removing values from a list [on hold]
For a hobby I am making a quiz on pygame to make it more graphical - looks better than just in the python shell! I have done snippets and when I run it it works, but I need to add extra things in. I ...
1
vote
1answer
43 views
Replacing values in a file based on values in another file
I am writing Python code which reads through two text files and prints the output based on those two files. Basically, the first file, demo.txt, has a matrix of numbers and the second file, days.txt, ...
1
vote
0answers
11 views
Object-oriented URL loading and HTTP client with requests in Python
I have an API which I want to consume in Python 3.x using the requests module.
Right now, my solution is to create Requests objects for each URL like the ...
3
votes
0answers
28 views
ID3 Decision Tree in python
I've been working my way through Pedro Domingos' machine learning course videos (although the course is not currently active). His first homework assignment starts with coding up a decision tree ...
1
vote
2answers
47 views
Blocking until condition is met
I have a class called _NodeProcess. It consists of a mainloop (main function) which is run in a separate process and methods ...
3
votes
2answers
35 views
Auto backup Chrome bookmarks
This script, once added to the Windows Scheduler, automatically creates a backup of your Google Chrome bookmarks.
...
2
votes
3answers
52 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 ...
2
votes
2answers
27 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 ...
1
vote
2answers
50 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
24 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
241 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
66 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
139 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
103 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 ...
8
votes
2answers
423 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 ...
3
votes
0answers
46 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
60 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
99 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
43 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
58 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
270 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
54 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
47 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
37 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
50 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
52 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
124 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
55 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 ...
7
votes
2answers
162 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
81 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
61 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
53 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
55 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 ...
4
votes
1answer
45 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
281 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
76 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
73 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
158 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
52 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
101 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
96 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
37 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
51 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
309 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
215 views