📜  python for 循环索引 - Python 代码示例

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

代码示例6
presidents = ["Washington", "Adams", "Jefferson", "Madison", "Monroe", "Adams", "Jackson"]
for num, name in enumerate(presidents, start=1):
    print("President {}: {}".format(num, name))