« first day (801 days earlier)      last day (1387 days later) » 

1:44 AM
0
Q: Cron execution of python script not working like expected

ronaldI have a python script which is executed by cron, it's purpose is to manage messages from users to other users. These messages are stored inside a mongodb database. The script crawls through the messages, looks for the target name, fetches it's _id from the db and stores the message data inside t...

 
 
3 hours later…
4:34 AM
0
Q: Writing a programme in Sage/python

GGTI am writing this code in sage online worksheet given a tuple say $a=(a_1,a_2,...a_n)$ \phi be an permutation in S_n then \phi(a)= (a_\phi(1),...,a_\phi(n)) I want to count the number of permutation that fixes a The code is as follows def Aut(tuple): c=1 for a in SymmetricGroup(len(tu...

 
 
4 hours later…
8:54 AM
0
Q: Code for Programming Challenge taking much time

DhruvI wrote the following code for this problem. The problem is to find the longest palindromic substring. I think it is correct and is working correctly for all the test cases I entered myself. Now, the code is producing a Time Limit Exceeded Error. I know that there exists Manacher's Algorithm whic...

 
 
3 hours later…
11:28 AM
0
Q: Read a specific row in csv on python

AnomonousI have a csv file on exel: ["11811818","apple" ,"0.75"] ["11811817","bannana","0.60"] In my python program I need the user to input a barcode [column 1] and the program will get the values from [column 2] and [column 3] from the row with the barcode on. This is what I have so far but I don't ...

 
11:44 AM
0
Q: Maximize points won by flipping coins

Mathias EttingerSo, there is this king-of-the-hill challenge going on at PPCG SE to which I submitted my participation. I won't change it further in terms of behaviour, so I wanted to know what you think of the code. The challenge It is very well described in the original post, I'll just summarize the key idea...

0
Q: What is the best way to extract method?

vildhjartaThe code snippet is what I want to do. Previously I use a different version of my code. But it is out of joint according to Python coding guidelines because I was assigned my lambda function to a variable. It was an obvious violation. Here is my violator code: my_dict = { 'first_name': 'Jimm...

 
 
2 hours later…
1:46 PM
0
Q: Intersections of two lists

LoomGiven two python lists a and b. These lists may intersect (It is possible that lists intersect more than once). There is an example: a = [1,2,5,7,6,9,1,3,1,2,6,6,3,1,2,6,1,3] b = [3,1,2] There are 4 intersections: [1,2,5,7,6,9,1,3,1,2,6,6,3,1,2,6,1,3] [3,1,2] [3,1,2] [3,1,2] [3,1...

 
2:03 PM
0
Q: How do you create a knockout tournament on python 3

joshhow would i program a knockout soccer tournament with 16 teams in it so that the winner of each round advances to the next round until there is a final winner. ie: 16 vs 1 (16 wins) and 8 vs 9 (8 wins) therefore 8 vs 16. So i want to be able to enter the score and then the winner will advance to ...

 
 
6 hours later…
8:13 PM
0
Q: 1D elementary cellular automata in Python – Basics and efficiency?

algomachineHow can I improve this simple code for an elementary cellular automaton "dumped" to the terminal (at least in OSX). import sys import random import time import os import fcntl import random WIDTH = 40 # How wide is the pattern? w = WIDTH * [0] # create the current generati...

 
 
2 hours later…
10:07 PM
0
Q: Python Generate and Execute Statements

pmvI have a series of statements that needs to evaluated with every iteration Currently I'm able to print the statements but I'm unable to execute them import pandas as pd import functools #STEP0: DEFINE DATA ELEMENTS- SCORE CARD AND STUDENT SCORES #SCORE CARD DATA score_card_data = { 'subj...

 

« first day (801 days earlier)      last day (1387 days later) »