Skip to content
Advertisement

Tag: range

Python Loops result not understanding [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 6 months ago. Improve this question Can anyone please help explain what the hell is going on with this

String Slicing in c# using intervals

In python there are ways that allow you to access the string using an interval(slicing): Example Get the characters from position 2 to position 5 (not included): Is there something similar in c#? Answer In C# 8.0 (or higher) you can use ranges, e.g Or on old c# versions, Substring: Finally, you can use Linq, but it’s overshoot here:

Using a for-loop and range function vs a while-loop

I’m looking for a function like range except that the step is a fraction of the previous number generated. So if the fraction was 99/100 the set of numbers might be something like this: 100, 99, 98.01… 0.001 Would this be more efficiently done with a for-loop and range-like function or with just a while-loop? The code I have so

Advertisement