我的列表在切换时只显示“9”作为第一个索引。

huangapple go评论56阅读模式
英文:

my list only displays "9" as the first index when switching

问题

我很明显是一个初学者...我的问题是每当我交换随机列表中的第一个和最后一个元素时,第一个索引总是被分配为"9",尽管在列表中根本没有"9"。

感谢帮助

我只想交换第一个和最后一个索引。

英文:

I'm pretty clearly a beginner... My problem is that whenever I switch the first and last element in a random list, the first index always gets the nb "9" assigned even though there is no 9 in the list in the first place.

THX 4 help

I literally only want to switch the first and last index
我的列表在切换时只显示“9”作为第一个索引。

答案1

得分: 1

在第17行,您将数组的元素0分配给了9

z_unsort[0] = (anzahl - 1)

并且在您的输出中,您将anzahl分配为10

我认为这是一个打字错误。

英文:

On line 17 you assign element 0 of the array to 9

z_unsort[0] = (anzahl - 1)

and in your output, you assigned anzahl to be 10

I assume this is a typo

huangapple
  • 本文由 发表于 2023年6月13日 04:06:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76459984.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定