Greeting all, would like to seek for your advice on the encountered issue as the output is not as expected.
my code as below:
score = []
total = 0
def mark():
counter = 1
size = int(input("Please Enter The Number of Subjects in Semester: "))
for cnt in range (size):
value = int(input(f"Please Enter Mark of Subject {counter} : "))
score.append(value)
counter = counter + 1
total = sum(score)
mark()
print(score)
print(total)
and the output is:
Please Enter The Number of Subjects in Semester: 2
Please Enter Mark of Subject 1 : 10
Please Enter Mark of Subject 2 : 10
[10, 10]
0
Question 1: How can I turn the print(total) output to be sum of the values in the list instead of 0 without using Global variable?
Question 2: Why the list can get append but the score not making the sum?