Calculate inputs average
type=number inputs can be error-prone because it's easy to mistakenly adjust a value with the mouse wheel.  Unless you specifically intend to enter grades with a mouse wheel, or have some other use for that interface, go with regular text fields.

You're testing the truth of element.value as a string and then adding it as a number.  It's good practice to be explicit about these kinds of conversions. 

It would be nice to generalize the code to handle any subject, without the use of hard-coding or copy-and-paste.  

We only need the subject name to put a label next to the inputs; the code doesn't need to know it at all.   The code snippet below uses the name=... attribute to label the inputs (via CSS) and class=subject to denote an average-eligible set of inputs.  The number of inputs is determined solely by the HTML.



document.getElementById('calculator').addEventListener('click', function() {
    Array.from( document.getElementsByClassName('subject') ).forEach(subject =&gt; {
        const scores=Array.from( subject.getElementsByTagName('input') ).map( e =&gt; ""+e.value.trim() ).filter( s =&gt; s.length ).map( n =&gt; parseFloat(n) ),
          output=subject.getElementsByTagName('output'),
          sum=scores.length ? scores.reduce((partial_sum, a) =&gt; partial_sum + a) : 0,
          average=scores.length ? ( sum / scores.length ).toFixed(2) : "No assessment made!"
      if (output.length) output[0].textContent = average;
  })
});
    
.subject::before {  text-transform: capitalize; content: attr(name) ": " }
.subject &gt; input { width:3em }
&lt;form&gt;
  &lt;p class=subject name=physics&gt;   &lt;input&gt; &lt;input&gt; &lt;input&gt; &lt;output/&gt;  &lt;/p&gt;
  &lt;p class=subject name=history&gt;   &lt;input&gt; &lt;input&gt; &lt;input&gt; &lt;output/&gt;  &lt;/p&gt;
  &lt;p class=subject name=chemistry&gt; &lt;input&gt; &lt;input&gt; &lt;input&gt; &lt;input&gt; &lt;output/&gt;  &lt;/p&gt;
  &lt;p class=subject name=algebra&gt;   &lt;input&gt; &lt;output/&gt;  &lt;/p&gt;
  &lt;button type=button id=calculator&gt;Calculate&lt;/button&gt;
&lt;/form&gt;