Exercise 2

Exercise 2
1 / 3
next
Slide 1: Slide
Ilearningdeal@gmail.comFurther Education (Key Stage 5)

This lesson contains 3 slides, with text slides.

Items in this lesson

Exercise 2

Slide 1 - Slide

Exercise 2
EXERCISE 2 – SELECTION COMMANDS AND LOGICAL OPERATORS

Using the three different selection commands, write a basic program that fulfils the following specification for a college looking to make a programme that interprets inputting marks for a test and gives a grade.
• A single mark is entered by the user
• If the mark is > 80 then echo out the result as a grade A
• If the mark is>= 65 then echo out the result as a grade B
• If the mark is>= 50 AND <=64 then echo out the result as a grade C
• Else the grade is D

Slide 2 - Slide

#. Take a single mark input from the user
mark = int(input("Please enter the test mark: "))
# 2. Use the three selection commands to interpret the grade
if mark > 80:
    print("Grade: A")
elif mark >= 65:
    print("Grade: B")
elif mark >= 50 and mark <= 64:
    print("Grade: C")
else:
    print("Grade: D") 1
)

Slide 3 - Slide