在列表中有15个数字时,如何解决此问题,我们在插槽5中找到给定的数字,然后打印该插槽



当列表中有15个数字时,我们在插槽5中找到给定的数字,然后打印插槽?

您只是在15个数字列表中搜索第五个数字吗?

list = []
for i in range(15):
    i+=1
    list.append(i)
#above is only creating the list
print(list[4])#prints 5th entry in the list

如果您想了解更多有关Python数组或类似的信息:https://www.w3schools.com/python/python_lists.asphttps://www.w3schools.com/python/python_arrays.asp

最新更新