Exercise 2

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

In deze les zitten 3 slides, met tekstslides.

Onderdelen in deze les

Exercise 2

Slide 1 - Tekstslide

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 - Tekstslide

#. 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 - Tekstslide