If list index exists, do X

前端 未结 12 881
清酒与你
清酒与你 2020-12-02 11:41

In my program, user inputs number n, and then inputs n number of strings, which get stored in a list.

I need to code such that if a certain

12条回答
  •  佛祖请我去吃肉
    2020-12-02 12:19

    Could it be more useful for you to use the length of the list len(n) to inform your decision rather than checking n[i] for each possible length?

提交回复
热议问题