What does "= 0" mean in Python? -


i doing online course , when 1 of lessons kind of lost me. maybe don't remember it, "= 0" mean in following program? can't find clue in notes , instructor doesn't explain here.

**count = 0** **total = 0** infile = open('grades.txt', 'r') grade = infile.readline() while (grade):     print(grade)     count = count+1     total = total + int(grade)     grade = infile.readline() average = total / count print("average: " + str(average)) 

i feel i'm forgetting fundamental here.

the = operator called "assignment" operator. now, plenty of people on stackoverflow going tell assignment yourself, feel since such basic question.

it's being set 0 since later, operations count = count + 1 require count have value begin with. adding + 1 none doesn't work nicely, , if did, it's nice when reading code see variables declared in advance.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -