📜  带有索引的 for 循环 python 代码示例

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

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