1
I was doing the following exercise : "Make a program that reads 4 notes , show the notes and the media on the screen. "
My show went like this :
lista = [ ]
i = 0
soma = 0
while(i < 3):
nota = int(input("Digite a nota do aluno:")
lista.append(nota)
i = i + 1
soma = soma + nota
media = soma/4
print("As notas foram:", lista)
print("A media foi:", media)
However, it is giving syntax error in the list (lista.append(nota)
). Does anyone know why ?
Missed a close one
)
in the previous row, referring to the functionint
.– Woss
What nonsense , thank you very much. Missed put i < 4 too.
– user158657
The @Andersoncarloswoss explanation, got a little obscure, IMO, actually lacked parentheses in the int line itself, so... Change the line:
nota = int(input("Digite a nota do aluno:")
fornota = int(input("Digite a nota do aluno:"))
– Sidon
I switched and everything worked out. Thank you !
– user158657
@user158657 , is less prone to error if you change this
while i < 3
by afor i in range(4)
. See more in that reply– Jefferson Quesado