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

learn more… | top users | synonyms

0
votes
0answers
8 views

Python TKinter data entry window GUI for SQLITE3 table

I would like to offer for review a simple tkinter GUI window in Python 3 to be used for data entry into an SQLite database table. As a noob, this is my first attempt at OOP and my first experience ...
0
votes
0answers
19 views

Iterative tree traversal to turn tree into a dictionary and list

I am trying to iteratively turn a tree into a list. For example: c1 c11 c12 c111 c112 The tree above ...
1
vote
1answer
11 views

Excel Laboratory Data Entry from Python 2.7

I've written a script to automate the entry of laboratory instrument data into an Excel spreadsheet using pandas and win32com. I've got the script functioning correctly, but it is painfully slow. In ...
4
votes
1answer
38 views

Guess the Number Game in Python

I have been using Python to learn programming, but I am just recently beginning to utilize classes. I have a basic game below. Please review and let me know what I should improve on. ...
0
votes
0answers
22 views

Creating a hexagonal grid [on hold]

The objective of this code is to create a hexagonal grid (honeycomb type). This code is written by a friend and it contains lots of junk that do not contribute towards the objective. ...
1
vote
1answer
32 views

Filtering multiple large (>2gb) csv files with stock prices

I have a set of pretty large files (>2 GB, over 30m rows) containing intraday data in the following format: ...
3
votes
0answers
28 views

Merging multiple JSON files using Python

I have multiple (1000+) JSON files each of which contain a JSON array. I want to merge all these files into a single file. I came up with the following, which reads each of those files and creates a ...
2
votes
1answer
31 views

Project Euler #2: sum of even Fibonacci numbers, using generators

I am currently working on Project Euler problem #2 which requires you to print the sum of all even fibonacci numbers below 4 million. I just recently learned about generators and from my ...
0
votes
0answers
8 views

How to use writerow or append to print iterable to CSV column? [on hold]

I'm struggling with an easy question. I would like to be able to print 'value' to a column as many times as there are integers in 'count'. I can print the correct result, but not write to a list in a ...
1
vote
1answer
19 views

Extracts marks of all students in class from website

This code extracts marks of all students in class and stores the result in a file results.txt, using BeautifulSoup. I'm looking for code review and suggestions. ...
1
vote
1answer
29 views

Terminal program engine

I wanted to create an example of developer-friendly, maintainable, expandable, reusable understandable module that could be used by other programmers even though it won't. Thus, I started developing a ...
1
vote
2answers
24 views

Basic functions (sum, len, etc.) with recursively-flattened arguments

Based on the excellent answers provided for my previous question, I've thoroughly revised my attempt at "deep" versions of all, ...
2
votes
0answers
49 views

Discretization of continuous attributes for automatic classification [on hold]

Background In machine learning, it's common to encounter the problem of making a decision as to which discrete category an object belongs to based on a set of continuous attributes. For example, we ...
2
votes
0answers
34 views

Simple stack and linked list

I know that Python has a built-in list data structure, but I want to implement my own linked list and stack data structures for practice. I have three classes ...
0
votes
0answers
38 views

Is there a memory leak in this Python code that uses Pillow? [on hold]

I recently have encountered a memory leak in this code: ...
5
votes
2answers
50 views

App for displaying pictures to like

I am making an app that shows some pictures and you can like each picture. I am sending a POST request from the Android device. In my backend I have a Python script that takes parameters category and ...
12
votes
2answers
351 views

Split string in half and change case accordingly

I found the following challenge online: Create a function that takes a string and returns that string with the first half lowercased and the last half uppercased. eg: ...
2
votes
1answer
58 views

Priority Queue Linked List Implementation

I am new to Python and wanted to make sure my code answers the question for my assignment due. My Task: A priority queue is a queue in which each item is assigned a priority and items with a ...
6
votes
1answer
66 views

Python text game

I've written a simple text game in Python to show you. I would be glad if you would spare a quick look and point out the style errors so I wouldn't pick up bad habits. ...
0
votes
1answer
57 views

Cartesian product of two tuples - python

I'm solving exercise 4 from Discussion 3 of Berkley's CS 61A (2012) (see page 4): Fill in the definition of cartesian_product. ...
6
votes
3answers
358 views

Deep/recursive join, all, any, sum, len

I keep forgetting that the standard join() can only take a single iterable, so I made a few functions that act recursively on any passed arguments. Somewhat ...
1
vote
3answers
72 views

Minimum element in a tuple

I'm solving exercise 2 from lecture 3 of Berkeley's CS 61A (2012): Write a function min_element that returns the minimum element in a tuple. ...
1
vote
2answers
53 views

War card game simulator

My teacher wants us to create a program that runs n games of war and calculates the average number of battles, wars and double wars that occurred. He has very specific rules (not necessarily the ...
1
vote
0answers
20 views

Website monitor - if site is down, kill the process, contact admin and restart server

My python-based web server (tornado module) is pretty complex and keeps going down (seems like usually in the middle of the night), so here's a bash script that kills the process, restarts and emails ...
1
vote
1answer
41 views

Generating realistic terrain data

I have some fascination with terrain generators, so I whipped up this generator in Python. The way it works is pretty simple, but I figure that I should give an explanation for those who don't want to ...
3
votes
1answer
44 views

Expandable, object-oriented tic tac toe module

Just for practice, I am writing a tic tac toe game in Python 3.4. My main goal is to make expandable, for example allowing larger boards and more than two players. The way my project is arranged ...
-1
votes
1answer
33 views

Map a function to all elements of a tuple

I'm solving exercise 3 from lecture 3 of Berkeley's CS 61A (2012): Fill in the definition of map_tuple. map_tuple takes in a ...
1
vote
1answer
57 views

Check existence of HTML tags in a row

Using Python's Beautiful Soup, I analyze a number of html files (internally: soup). They are all a little different and my target comes in four different tags - or ...
-1
votes
1answer
33 views

Locker puzzle in Python

(Game: locker puzzle) A school has 100 lockers and 100 students. All lockers are closed on the first day of school. As the students enter, the first student, denoted S1, opens every locker. ...
-1
votes
0answers
19 views

Fetching data in Python [closed]

I'm fetching the total data from URL in Python, but some data is coming further I'm trying to take other data it's not coming. ...
0
votes
0answers
41 views

Parsing big JSON files efficiently

I have two files ...
0
votes
1answer
14 views

Dynamic building of URLs

I'm teaching myself Python and wanted to share this problem as my current solution feels inelegant but I'm not sure of the best way to refactor. If this sort of question isn't appropriate, leave a ...
3
votes
3answers
72 views

RockPaperScissor in Python

This is a simple Rock - Paper - Scissor game. I'm trying to find a better way to write the algorithm and keeping the scoreboard. ...
6
votes
1answer
66 views

NotBF - A Brainfuck-ish like “language”l

I've made an interpreted language that's like Brainfuck except it has keywords instead of characters. Here's an explanation of the commands, and how to run it. ...
6
votes
1answer
63 views

Moody game characters

I've been doing some self-imposed exercises to get accustomed to Python and below is my code. ...
4
votes
1answer
35 views

Reading in a series of Excel files

I needed to create a program which reads in a series of Excel files in folders typically structured something like this. ...
0
votes
0answers
13 views

How to use logged exception in if statement in Python [closed]

I have an SMTP email handler which logs and emails my traceback errors, this is built with a try/except block. I would like to use a conditional statement that says if an email is sent then do ...
4
votes
1answer
229 views

Huge terminal game (in development)

I'm developing a big (for me, as a beginner) terminal program "Brainfuck - The Game", in which you have to complete Brainfuck challenges. I would like your review on existing code (and project ...
1
vote
0answers
33 views

File transfer using yandex.ru cloud storage

I've made a "envtransfer" application transfer environment between computers using Yandex disk application. I would like to hear the opinion of the code. Big thanks. User authorize, get token, export ...
-1
votes
0answers
26 views

Python Dice Rolling simulator [closed]

I am a beginner at python, taking an introductory course. My professor just assigned a program to us. However, when he assigns he has a problem with not really going too much into what needs to be ...
7
votes
1answer
167 views

Line segment to circle collision algorithm

I've written a function (in Python 3) which computes if a line segment (constraint) and a circle (body) collide, and returns the point of intersection (closest point to the centre of the circle): ...
-3
votes
0answers
33 views

Short Python for fun [closed]

I am new to Python (~9 Month). Its a lot of fun because code allways looks good and is structured. But with a bit of trial and error i found out that this is only because of god practice and not ...
3
votes
2answers
168 views

Recursive math expression eval

It has been very hard to use recursion, but I think that it made the code shorter and cleaner. ...
0
votes
2answers
83 views

Changing algorithm to avoid looping with iterrows

I am new to Python. I wrote a code that works but the algorithm is obviously not efficient at all. I am stuck in the loop on iterrows and I do not see how to get rid of it. First a little bit on the ...
1
vote
1answer
23 views

Reordering OrderedDict

Goal: create a new OrderedDict instance's keys in such way that keys in the specified order list appear first. If some keys in order list are not present in ...
1
vote
1answer
34 views

Monte Carlo asset price simulation

I'm trying to write a simplistic Monte Carlo simulator to predict asset prices. For example, if something has an initial value of 50 and an historic daily standard deviation of 2, what are the odds it ...
1
vote
0answers
49 views

Using BeautifulSoup to scrape various tables and combine in a csv file

Looking for some feedback/criticism/improvements to a piece of code I've written. It works as intended but I'd like some feedback! Quick overview of what it does. A page contains a table of links, ...
-1
votes
2answers
73 views

Parsing a big text file, extract data & store it in a CSV file

I have a big log file (say 1-3 Gb) which I need to parse, extract data & save it in a CSV file. Text File Data ...