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

Python: Rotate Nested Lists -90°

I'm new to programming and I'm having trouble with a school assignment. I need to print the… Read more Python: Rotate Nested Lists -90°

Python - Count Occurrences Of Certain Ranges In A List

So basically I want to count the number of occurrences a floating point appears in a given list. F… Read more Python - Count Occurrences Of Certain Ranges In A List

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

Dictionary With Range As Key

In Python, how can I map from a range of values to one concrete value? Basically, I want a dictiona… Read more Dictionary With Range As Key

How Do I Convert A List Of Numbers Into Their Corresponding Chr()

c = list(range(97, 121)) if i print this it will give [97, 98, 99, 100, 101, 102, 103, 104, 1… Read more How Do I Convert A List Of Numbers Into Their Corresponding Chr()

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