I am trying to add 1 to my variable and then add this variable to a list so when I print out my list, the value of the variable is within it. However, my code prints out an empty list despite me adding the variable to it.
case_number = 0
case_numbers = []
issue = input('Has the issue been solved?').lower()
if issue == 'no':
case_number += 1
case_numbers+[int(case_number)]
print(case_numbers)
+creates a new list which you're discarding. What you want iscase_numbers.append(int(case_number))case_numbers+=[int(case_number)]case_numbers+=[int(case_number)](forgot the equal)case_numbers.append(...).case_numbers.append(int(case_number))is the standard way. The reason your approach doesn't change the list is that you don't assign the modified list back tocase_numberse.g.case_numbers = case_numbers + [int(case_number)]