#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ ENGG1811 Lecture 2 Purpose: This example demonstrates chain selection using if/elif/else Program description: This program asks - the user to input a mark - determines the grade for that mark Limitation: Does not check whether mark is valid. """ # Ask the user to input a number mark = float(input('Please input a mark: ')) if mark >= 85: grade = "HD" elif mark >= 75: # (mark >= 85 is false) and (mark >= 75 is true) grade = "DN" elif mark >= 65: grade = "CR" elif mark >= 50: grade = "PS" else: # Not (mark >= 50), so mark < 50 grade = "FL" print('The mark',mark,'gives the grade',grade)