Skip to content Skip to sidebar Skip to footer
Showing posts with the label Range

Python - Optimisation Of Perfect Number Search

p = [] for x in range(1, 50000000): count = 0 for y in range(1, x // 2 + 1): if (x … Read more Python - Optimisation Of Perfect Number Search

Check Which Range A Number Is Within

I need to find which range a number, in this case value, is within. I cannot find any other way to … Read more Check Which Range A Number Is Within

Full-range Random Number In Python

I'm generating a series of random floats using this line: random.random()*(maxval-minval) + min… Read more Full-range Random Number In Python

Add Days To A Date In Python Using Loops, Ranges, And Slicing

I'm a beginner in python and I've recently learned how to do the basics of: functions, loop… Read more Add Days To A Date In Python Using Loops, Ranges, And Slicing

Should I Cache Range Results If I Reuse Them?

I'm relatively new to python, and I'm trying to optimize some code for a HackerRank problem… Read more Should I Cache Range Results If I Reuse Them?

Why Do I Not Have To Define The Variable In A For Loop Using Range(), But I Do Have To In A While Loop In Python?

I have the following code using a for loop: total = 0 for num in range(101): total =… Read more Why Do I Not Have To Define The Variable In A For Loop Using Range(), But I Do Have To In A While Loop In Python?

How Can A Numpy.ufunc.reduceat Indices Be Generated From Python Slice Object

Say I have a slice like x[p:-q:n] or x[::n] I want to use this to generate the index to be passed i… Read more How Can A Numpy.ufunc.reduceat Indices Be Generated From Python Slice Object

Python - Optimisation Of Perfect Number Search

p = [] for x in range(1, 50000000): count = 0 for y in range(1, x // 2 + 1): if (x … Read more Python - Optimisation Of Perfect Number Search