Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

because n2 syntax is not working

+1 vote
asked Oct 25 by Eric Kauan (130 points)
n = (float (input ("primeira nota:"))
 n2 = (float (input ("segunda nota:"))
  n3 = (float (input ("terceira nota:"))
   n4 = (float (input ("quarta nota:"))
M = n + n2 + n3 * 3 + n4
M2 = M / 7 print ("Media do aluno", M2)

2 Answers

0 votes
answered Oct 25 by Harshith .R (360 points)
n = float (input ("primeira_nota:"))
n2 = float (input ("segunda_nota:"))
n3 = float (input ("terceira_nota:"))
n4 = float (input ("quarta_nota:"))
M = n + n2 + n3 * 3 + n4
M2 = M / 7
print ("Media do aluno", M2)
0 votes
answered Oct 26 by Peter Minarik (63,140 points)

A language has strict syntax. You have to follow the rules.

Here are some violations in your code:

  1. You have to match the opening parentheses with closing parentheses
  2. You have to match indentation level
  3. You have to put new instructions into new lines.
Your code fixed would look like this:
n = (float (input ("primeira nota:")))
n2 = (float (input ("segunda nota:")))
n3 = (float (input ("terceira nota:")))
n4 = (float (input ("quarta nota:")))
M = n + n2 + n3 * 3 + n4
M2 = M / 7
print ("Media do aluno", M2)
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.