Syntax Error Help...Javascript Fundamentals - Change Final Grade

Please help…I keep going over this and have reviewed other help topics on this exercise and just don’t see what I’m missing?

https://www.codecademy.com/paths/full-stack-engineer-career-path/tracks/fscp-javascript-syntax-part-i/modules/fecp-practice-javascript-syntax-variables-data-types-conditionals-functions/lessons/javascript-fundamentals-code-challenge/exercises/final-grade

Error:
/home/ccuser/workspace/js-challenge-final-grade/main.js:3
if ((num1 <=0 || >=100) || (num2 <=0 || >=100) || (num3 <=0 || >=100)){
^^
SyntaxError: Unexpected token >=

// Write your function here:
const finalGrade (num1, num2, num3) =>{
if ((num1 <=0 || >=100) || (num2 <=0 || >=100) || (num3 <=0 || >=100)){
return ‘You have entered and invalid grade.’
} else {
let avg = ((num1 + num2 + num3)/3);
if (avg >= 0 && <= 59){
return ‘F’
} else if (avg >=60 && <=69){
return ‘D’
} else if (avg >=70 && <=79){
return ‘C’
} else if (avg >=80 && <=89){
return ‘B’
} else (avg >=90 && <=100){
return ‘A’
}
}
};

The way you wrote this, you’d be saying something like this:
If num1 is less than or equal to zero or ?? is greater than or equal to 100…

You need to specify the variable you’re comparing in both sides of the condition, like this:

(num1 <= 0 || num1 >= 100)

Hope this helped :slight_smile:

2 Likes

We call them operands when they are within a logical expression. The point is correct, though. Python (and nearly any other language) does not infer the variable in a conditional, we must explicitly state it.

2 Likes