All Questions
Tagged with functional-programming python
122 questions
3
votes
2
answers
185
views
Map coloring algorithm functional implementation in python
I'm an autodidact working on map coloring algorithms with backtracking, see chapter 2 of this book.
I tested this implementation with success but I'm still unsure whether it is tricking me somewhere, ...
4
votes
4
answers
1k
views
Merging sorted integer arrays (without duplicates)
I have written a Python function called merge_arrays which takes two lists and returns the new list merge without duplicate.
The function works as expected, but my ...
1
vote
2
answers
72
views
Imrove performance when updating DataFrame rows based on complex criteria
My question got rejected the last time so I am trying a better approach to getting a solution:
...
1
vote
2
answers
627
views
Removing Elements from an Array Based on a Second Array
I've written a function that takes two arrays of integers as input and removes all the elements in the first array that are also present in the second array. I would like to share my code with you and ...
1
vote
1
answer
62
views
Optimizing the Dig Pow function
I have written a Python function to solve the Dig Pow problem, where the goal is to find a number k such that the sum of each digit of n raised to a specific and ...
7
votes
5
answers
1k
views
Optimizing a function to find the closest multiple of 10
I have written a Python function called closest_multiple_10() which takes an integer as input and returns the closest multiple of 10. The function works as expected,...
3
votes
0
answers
77
views
A Haskell-style "maybe" type in Python, version 2
I have decided on a preferred solution to my question A maybe type in Python. Which implementation is best?, and have expanded it to be more ergonomic. I have implemented a host of utility functions (...
-2
votes
1
answer
1k
views
Create a function with two parameters: a list and a string, where the string has the following values [closed]
I tried so many things to do this task. I have no idea why doesn't it work. Please help!
...
4
votes
2
answers
749
views
MP3 Playlist Class in Python
Background Info
I am an intermediate level Python programmer. This is my implementation of a MP3 Playlist class challenge that was hosted on 101 Computing.Net. The ...
1
vote
2
answers
109
views
UPDATE on Newspaper Bill Calculator CLI with Python (1 of 3, Core)
Code is posted after explanation.
Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused.
Post 2 of 3, CLI: UPDATE 1 on Newspaper ...
2
votes
1
answer
129
views
Newspaper Bill Calculator CLI with Python (1 of 3, Core)
Code is posted after explanation.
Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused.
Post 2 of 3, CLI: Newspaper Bill ...
1
vote
1
answer
286
views
Fizzbuzz Solution - complexity, readability, performance, lines, obfuscation... - .sort()
The fizzbuzz challenge presents a lot of interesting questions for 'intermediate' programmers like myself. I have found that I don't actually know where to draw the line with, complex (hard to read ...
4
votes
1
answer
167
views
Functools extension library
I wrote a utility library inspired by functools that adds some common operations on functions I frequently use in my projects.
As usual I'd appreciate any feed back....
2
votes
2
answers
1k
views
Improving the Conway's Game of Life Code With Functions in Python
This query is a part of Conway’s game of life. Currently, this program takes about 70 lines of code in Python to return the functionality of the game, which can be simplified to fewer lines of code ...
2
votes
1
answer
357
views
Garden simulator [closed]
I tried to write the program so that it runs without error but I want to improve the program so that it follows the Single Responsibility Principle. What changes can I make to improve this program? I ...