Earlier quoted context omitted.
Okay sure those are simple examples that are probably available in large quantities online, but why should that homework assignment count towards a grade is more of my point. Professors can assign homework that isn't graded and the ones who actually do the assignment will be the ones that learn.
Graded homeworks might be used as checkpoints verifying that students are learning key concepts, prior to the exams that are a larger component of the grade. Without these graded checkpoints, lazy students given only voluntary homeworks might reach the exam with little preparation (lazy student speaking from personal experience. being graded on the homework 'encouraged' learning the concepts!)
And that is bad, why exactly? You're unprepared, you fail, you learn a lesson, you retake. Repeat until done. I too was a lazy student and found that failing a few classes and having to resit the exam was a fine way to motivate you to study.