Answer to Question #298974 in Python for DRAX

Question #298974

Write the Python code of a program that reads a student’s mark for a single subject, and prints out the corresponding grade for that mark. The mark ranges and corresponding grades are shown in the table below. You need to make sure that the mark is valid. For example, a student cannot receive -5 or 110 marks. So, the valid marks range is 0 to 100.

1
Expert's answer
2022-02-17T07:39:32-0500
mark = int(input())


if mark < 0 or mark > 100:
	print("mark is invalid")
else:
	if mark < 60:
		print("F")
	elif mark < 70:
		print("D")
	elif mark < 80:
		print("C")
	elif mark < 90:
		print("B")
	else:
		print("A")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS