All Questions
Tagged with comparative-review python-3.x
54
questions
5
votes
1
answer
213
views
Compute the mean of a series of user-entered numbers
Which is more elegant out of two methods as mentioned below mostly from memory prospective?
Both methods achieve the same result, but from a memory perspective, In Method1, we are storing the running ...
2
votes
3
answers
107
views
Wordlist formatter code
I am making a "wordlist cleaner" module that loads a words.txt file, and returns a list of cleaned/sorted words.
Full code:
...
1
vote
1
answer
203
views
Excluding attributes entirely vs. setting them to None
I am making a program that parses profiles from a website. Some profiles are "public" and others are "private" with limited information. Public profiles contain a lot more data and ...
3
votes
2
answers
930
views
Convert Rankine temperatures to Celsius
I have this Python Package called ToTemp under development for precise Temperature Conversions and currently thinking in changing the method's implementation to be ...
0
votes
1
answer
71
views
Comparison of two ways of looping in Python [closed]
I wrote a small script to demonstrate two ways of looping in Python: with and without using the index. I want to know which way is better. Please see the example:
...
2
votes
4
answers
1k
views
Calculate the median value of combining two sorted lists
I have solved a leetcode problem (Median of Two Sorted Arrays), and I came up with two solutions.
Solution 1
...
2
votes
1
answer
153
views
LeetCode#494 target sum (dart is slower than python)
I'm trying to solve a LeetCode problem target-sum, in two languages: Python & Dart. The difference of time taken is shocking for me"
Python took ~70ms while Dart took ~900ms !! Why does Dart ...
5
votes
1
answer
330
views
Calculate the number of people occupied at each time interval
The following scripts calculate a list with the number of people occupied at each time interval.
The intervals are defined by the timestamps of two consecutive events that come from the sorted list <...
3
votes
1
answer
1k
views
Python function to output a string that is justified to the right
I just solved this exercise from Think Python, 2nd edition:
Python provides a built-in function called len that returns the length of a string, so the value of len('allen') is 5. Write a function ...
2
votes
0
answers
56
views
Python: How to best create a dictionary from another dictionary in a library
I have the following code which builds up a dictionary of endpoints that I iterate through later on. Is this the cleanest, most scalable and performant way?
I was thinking of adding a list as a key to ...
0
votes
1
answer
204
views
Convert string to 10 character string with leading zeros if necessary
I have the below data and am obtaining the expected output column for it.
...
1
vote
2
answers
119
views
Search for text in a file
I have this implementation of Grep where I use re.search:
...
2
votes
1
answer
105
views
Dose tracker with daily and weekly totals
This is an old script I made a while ago.
What it does
It tracks your dose of whatever you want tracked (cigarettes, salt, etc), outputs the total for each day, and the full week.
What I’m looking for
...
3
votes
1
answer
820
views
Using Numba works slower than not using it for my Python code
I thought this community is better place to ask my question so I ask here rather than at StackOverflow.
Recently, I learned that Numba can make Python function ...
1
vote
0
answers
54
views
Asking for feedback, when utilizing Pandas, why is it better to use pandas.Series than lists data type?
I found out the hard way, when utilizing pandas is better to use pandas.Series than lists data type to manipulate data.
Even if ...