如何检查数组的所有元素是否都用Python填充

时间:2019-03-12 00:28:28

标签: python

我正在使用数组或列表在Python中制作“待办事项列表”应用程序。我想检查包含所有“待办事项”的数组是否已满。如果已满,我会通知用户该列表已满。 我仍然是初学者。

todo_list = ["1.)", "2.)", "3.)", "4.)", "5.)", "6.)", "7.)", "8.)", "9.)", "10.)"]
def addTask(taskName):

  '''
  this is a global variable to keep track of what index the last task was 
  placed in.
  '''


  global x
  x = int(x)
  num = x + 1
  num = int(num)
  taskName = str(taskName)

  '''
  This is what I tried to make the program start from the beginning if the 
  list was full.
  '''

  if x > list_length:
    x = 0
    todo_list[0] = None


  todo_list[x] = str(num) + ".) " + taskName
  x = x+1

  print("Done!")
  main()

0 个答案:

没有答案