Challenge 2

Write a program that checks an integer variable called exam_mark. Start with exam_mark set to 70.

If the variable is less than 0 or more than 100 print “This isn’t a valid result.”

If the variable is between 0 and 50 (inclusive) print “You could do a lot better. Keep studying.”

If the variable is between 51 and 80 (inclusive) print “Good work. But don’t stop studying.”

If the variable is between 81 and 99 (inclusive) print “Great work. You really know your stuff.”

If the variable is 100 print “I think you should be teaching this course now.”

Try changing the value of the variable to check that all your options work correctly.


Report a Glow concern
Cookie policy  Privacy policy

Glow Blogs uses cookies to enhance your experience on our service. By using this service or closing this message you consent to our use of those cookies. Please read our Cookie Policy.