Python Homework - creating a new list

前端 未结 6 829
闹比i
闹比i 2021-01-22 19:36

The assignment:

Write a function called splitList(myList, option) that takes, as input, a list and an option, which is either 0 or 1. If the

6条回答
  •  旧时难觅i
    2021-01-22 19:57

    Henry Keiter's comment was correct. Just add one space before newlist.append(myList [i]) and it works just fine.

    Alternatively, if your teacher lets you, you could use tabs instead of spaces to avoid this problem altogether (just make sure you don't use both in the same file).

提交回复
热议问题