📜  python 使用索引迭代 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:41.499000             🧑  作者: Mango

代码示例6
presidents = ["Washington", "Adams", "Jefferson", "Madison", "Monroe", "Adams", "Jackson"]
for i in range(len(presidents)):
    print("President {}: {}".format(i + 1, presidents[i]))