Liste des Groupes | Revenir à cl c |
On 6/14/2024 11:56 PM, Keith Thompson wrote:DFS <nospam@dfs.com> writes:>>
After casting i to an int before any array addressing, // works.
I'm surprised you needed to convert i to an int. I would think that
just replacing nums[i/2] by nums[i//2] would do the trick,
as long as i always has an int value (note Python's dynamic typing).
If i is acquiring a float value, that's probably a bug, given the name.
I spotted the issue. Just prior to using i for array addressing I said:
i = N/2.
The fix is set i = int(N/2)
Les messages affichés proviennent d'usenet.