Translation:There are forty students in our class.
The best thing to do is just hit the Report button and say that your answer should be accepted. That's how Duolingo works as far as I'm aware, it's somewhat automated and imperfect, and as people come along and run into issues they get reported and fixed if necessary by an actual human translator.
I typed '40' and had no issues, so someone already did the work! If in doubt report it, that's what we're here for! It's not entirely a free ride ;)
As for the English grammar thing, the rule I see most often is to type the word if the number is under 10 (single-digits basically), and use numerals otherwise, but there are lots of cases where you'd want to break that rule to make things more specific or readable and so on. It's not a formal grammar rule anyway (as much as English even has them), it's more of a style thing.
Yeah, I got the same problem; I tried using '6' instead of 'six' or '5' instead of 'five', and I was constantly getting the questions wrong. I'm hesitant to report a problem, though, because I'm not sure if this is the way it's supposed to be.
If anyone has an explanation, I would appreciate it.
I vaguely recall a rule of English grammar that states that all numbers under 100 should be written out completely. I don't know if that's still a rule, but maybe Duolingo is trying to uphold it?
Seems silly if so, considering we're not writing formal publications or anything here!
These are all about style though (as in a publication's house style, or a manual of style) instead of grammar. Whether you write the digits or spell them out it's the same thing, but people have preferences about what looks better and what makes things more readable.
It's like the Oxford comma, people will argue the pros and cons but there's no right or wrong answer. People will sure like to tell you there is, though! Probably the best thing you can do is be consistent, and if you want to stick to a certain style then that will make things easier for you.