Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.

learn more… | top users | synonyms

2
votes
1answer
14 views

Creating and manipulating FITS files--astropy.io

I wrote a program that manipulated data from VLA observations and created FITS files to be used in creating spectral energy distributions of high redshift radio galaxies. I really tried to be as ...
7
votes
1answer
54 views

Checkers in Python 3

I'm writing a small checkers game in python (international rules) and I need some pointers here and there. For the moment, I am only drawing the board and checking the syntax of moves with a regex. ...
5
votes
5answers
690 views

Generate a dictionary of passwords

I have a Python script that generates a dictionary of all possible 3 digit password combinations. It essentially works by just nesting for loops. This is fine, but ...
3
votes
1answer
33 views

Minimal, Low-level Telnet API

I've started Python some days ago and wrote a small Telnet implementation according to RFC 854 and RFC 5198. It is pretty low-level and sending messages directly isn't even supported. The highest ...
5
votes
3answers
267 views

“Researcher Hatim is right or wrong” challenge

I wrote a program to solve a problem, I am not so good in python so want help to find areas where this program can be improved or simplified and readable too:- I got this problem in a code challenge ...
1
vote
1answer
17 views

An ETA plugin for hangoutsbot

This is a plugin for hangoutsbot/hangoutsbot that listens for words people say and then gives them an ETA and a link with directions. Happy to hear about any optimisations that could be made. ...
4
votes
1answer
38 views

Tic-Tac-Toe in Python 2.x

This is a class called Board which handles the tracking and checking of the state of the game. self.board is a dict of ...
5
votes
2answers
51 views

N-Bonnaci sequence calculator

The code calculates a n-bonnaci sequence to a certain number, based on the user's input. It then can print it to a file and/or print it to the console. The ...
-5
votes
0answers
33 views

How is my downheap algorithm? [on hold]

I am attempting to downheap on an array from the last interior node all the way up to the root, so that I am making mini-heaps from the bottom up. I have an algorithm that I believe will do this ...
6
votes
2answers
144 views

Validating ISBNs

I'm just looking for a cleaner way. Obviously I could store a variable for some of the int parts. Personally, I think the one-liner looks better and everyone's ...
2
votes
1answer
34 views

TicTacToe game in Python

I'd just like to ask if there's anyway to make the functions play_Game() or is_move_valid() anymore efficient. For example, ...
4
votes
1answer
56 views

Given a 2D array of digits, try to find the occurrence of a given 2D pattern of digits

My algorithm is quite simple. I simply iterate over the entire map arr and if I find the start of the combination I need to ...
-2
votes
0answers
18 views

Python random variable not working [on hold]

Im creating a text based game and I want to implement a fallout 4 'wasteland' system. I figured that a good way to keep everything random was to make a random.randint(1,10) function and some if ...
-3
votes
0answers
16 views

Pseudo-Code: Python Editing live Feeds to derive direction [on hold]

I am wondering if anyone can help me pseudo-code this one out. Issue: I have a live feed coming in coming in from a local host, port 3333. That data is feed is being updated with incoming x & y ...
4
votes
3answers
41 views

csview: A tiny utility to view csv files

Seeing a csv in table form is nicer then viewing it as row text, for example the csv from Calculate food company sales for the year (with headers added by me) looks much nicer in this table form than ...
1
vote
2answers
29 views

Web crawler class

I'm using my crawler class in the following manner and I'm beginning to think it's bad practice: crawler.py ...
2
votes
2answers
86 views

Password Trainer v1.0 - Helping you learn a new password

There are two reasons why many people choose weak passwords over stronger, more complicated ones: They don't know that their passwords are insecure They don't want to change to a better password ...
1
vote
1answer
21 views

Parsing data from big json field and geocode services then store to PostgreSQL using psycopg2 instead django-orm

This code works, but my boss told me that it's very bad code, and don't want to deploy it. It is my first time working as a programmer and I have at least 3 months of experience. ...
-1
votes
0answers
13 views

Python Bowling Issues [on hold]

I'm trying to write a program that pulls bowling scores from a text file, calculates the scores and displays everything in a nice frame format. I've gotten strikes, gutterballs, and spares all worked ...
1
vote
1answer
30 views

Created a frame with a disabled button, till check button is used, then return to starting state

I've been coding Python for little over 6 months now. I am self taught and I would like to ask for some help for myself and also for others in my position who's been wondering if they're going about ...
4
votes
1answer
36 views

Transliterating encryption/decryption code from python to C#

I'm attempting to transliterate a piece of encryption/decryption code written in python into C#; the code works on save data from a particular game. I can't code in python at all, but by referring to ...
-4
votes
0answers
25 views

python: (Checking ISBN numbers) [on hold]

this is my code! ...
7
votes
2answers
71 views

Calculate food company sales for the year

I am working on a Python project where a food processing company is trying to calculate its total sales for the year. Python has to read from a text file where its divided into for categories split by ...
-3
votes
0answers
11 views

skip_sum function has a bug [on hold]

So here is my code for this function def skip_sum(n): if n == 0 return 0 return n + skip_sum(n-2) It has a bug anytime I put n as an odd number i ...
2
votes
1answer
31 views

Functional Scrabble Word Score

Homework: Write a function to score a scrabble word. values is a global dict formatted as values = {'a': 1, 'b': 3,...} The ...
-1
votes
0answers
13 views

funtion roll takes the element at position n on the stack and makes it the top element [on hold]

So I'm trying to create a function called roll takes the element at position n on the stack and makes it the top element. For example, consider stack s as 1 2 3 4, where the left end is the bottom of ...
0
votes
2answers
40 views

Sorting two related lists

I have code that sorts two lists related with each other ...
8
votes
2answers
766 views

Q&A-based file editor

As part of my autodidacticism into all things Python related, I have decided to write a number of functions that I can save in a library for future use. One such function that struck me as useful to ...
2
votes
2answers
57 views

Python Hangman Game

This is my hangman game code for my GCSE computer science coursework. It has been submitted but I was wondering if there is anyway to improve it. ...
0
votes
0answers
59 views

Solution to King Kohima problem in Python

King Kohima problem: King Kohima has reserved a new exclusive street for his executive class employees where they can build their homes. He has assigned you to plan that street. You have to ...
1
vote
2answers
48 views

Lower the volume of my computer over time in Python

I wrote a program to gradually lower the volume of my computer when I go to sleep so I can fall asleep with TV or music on. This was my first time using argparse and I feel like there should be a ...
0
votes
0answers
13 views

pygame movement of character in Class does not work [on hold]

I am new to developing games. Before I used to place the movement of the main character in the while loop and it worked perfectly. Now I am trying to make a Class for the maincharacter as in can be ...
1
vote
0answers
17 views

Checking paginated website for new entries

I'm interested in determining the best way to check a paginated website for new entries. I want to be able to scrape pages 1, 2, 3, ... as necessary to get all updates. However the scraping is fairly ...
4
votes
3answers
202 views

Word frequency counter

I recently took a self-assessment question to assess my Python ability for an online class. The problem was to return the frequency of a word occurring, as part of a tuple. Implement a function ...
0
votes
0answers
21 views

Importing CSV data into DynamoDB using Python

This is my first time working with DynamoDB and I was wondering if what I did is a good way to extract data from a CSV document into DynamoDB. All input is appreciated. ...
2
votes
2answers
39 views

Efficiently index rows of numpy array by exclusion

I need a function that takes a numpy array and a row number as inputs and returns the array (or copy of the array) excluding the given row. I want to do this as efficiently as possible. ...
1
vote
0answers
16 views

Flask json rpc2.0 extension

I created a simple extension to handle JSON RPC 2.0 requests on flask I would like some feedback regarding usage here is an usage example: ...
-1
votes
0answers
20 views

Generators/Coroutines as a replacement for simple classes in data processing pipelines? [closed]

I have a data processing pipeline where some steps need an initialization phase which I would only would want to call once. I could employ classes and do the initalization in ...
2
votes
2answers
35 views

Split up an iterable into batches

I was writing a program that had a list of e-mail messages. It needed to group them into batches, with the condition that each batch must have at max 20 messages, and be maximally 50k in size (no ...
3
votes
2answers
39 views

Finding a pair of words from two files with a particular MD5

I have two txt files. Both contain 60k+ words in a list. I put together some code to loop through each file and concatenate the strings ...
2
votes
1answer
52 views

Creation of playlist to fake-split a full-album video

I created this snippet to "split" my full-album videos into its individual songs without the need of actually splitting the video file. I personally created this snippet because I enjoy reading all ...
-2
votes
0answers
23 views

Scrapy and extracting items on one page, then follwing link to extract more data [closed]

I am trying to get this spider to go to the www.newslookup.com/Business and first extract the date/time item['time'] the item ['source'] and then go into the article link and get the url and name. I ...
5
votes
2answers
56 views

Chen prime finder

I've written a programme to find Chen primes. A Chen prime p is a prime number where (p + 2) is either also a prime number or has two prime factors. I've got it working to the best of my knowledge: ...
6
votes
1answer
66 views

Read stdin like a dictator

Rags. Introduction All too often I find myself wanting to allow only a certain list of characters to be written to stdin, and only recently did I actually ...
15
votes
3answers
699 views

Setting the scene for a role-playing game

I made some games in Pygame, but I am still new to making games. I made this RPG game, and this code is just a part of the game. The game executes different Pygame files for different levels of the ...
4
votes
1answer
35 views

LRU caching decorator that caches in the instance and in a shared cache

I needed a caching decorator, that could be used with methods and functions, that could take typed args and kwargs, and that was Python 2.7 compatible. Therefore I started with a backport of the ...
3
votes
0answers
35 views

Scraping links from the first page of Google using Kivy

I'm making a scraper/web crawler using Kivy when I run the code it works but I'm not sure if what I'm doing is Pythonic because all the language I can find is about using the Kivy library. I'm unsure ...
3
votes
2answers
61 views

Dynamic class instancing (with conditional parameters and methods) based on a dictionary

In a RPG game I'm developing, after building a base Weapon class, instead of having many subclasses of Weapon, I want the ...
1
vote
2answers
79 views

Maths quiz that read/writes CSV files [on hold]

Could this code possibly be shortened, or even better be rewritten in the fewest lines of code possible? ...
6
votes
2answers
73 views

Dijkstra's algorithm using collections.namedtuple

I decided to try out some named tuples by implementing Dijkstra's algorithm to find the cheapest routes in a file like this (where each line represents node_a is ...