Tootips might not work so well on phones or tablets. Sorry.
AQA Computer Science GCSE
Programming Exam Question – Lowercase character checker
This is a seven mark paper 1 programming question. It was question 8 on the specimen exam paper and is, I think, quite hard to get your head around.
I suggest trying to write an answer by hand first and then attempting to program your answer. Does it work? What did you get wrong?
The Question:
Write a Python program that inputs a character and checks to see if it is lowercase or not.
Your program should work as follows:
- gets the user to enter a character and store it in a suitable variable
- determines if the entered character is a lowercase character
- outputs LOWER if the user has entered a lowercase character
- outputs NOT LOWER if the user has entered any other character
You should use meaningful variable name(s), correct syntax and indentation in your answer.
The answer grid contains vertical lines to help you indent your code accurately.
[7 marks]
Hints
- you don't need to check that the user entered a single character.
- a lowercase character means one that is not a capital letter. So, a, b, c etc...
You can uncover a set of hints below.
- there are two marks for letting the user enter a character and storing it in a variable. I have a page about how to input (and output) values if you need it
- you will need to use selection – if you construct this properly you'll get a mark even if your logic is wrong
- there is a mark for outputting the two outputs – but you must spell the words correctly!
- there's a mark for using a meaningful variable name even if you get the program very wrong indeed
But you might not know that:
- You can use > and < on strings as well as on numeric values
Suggested Test Data:
Because no validation is required, you could enter any value, including a string longer than one character But I don't think you need to test that really. I'd suggest the following as simple tests:
Test type | Test data | Expected result |
Normal data | y | LOWER – this is an expected value and a lowercase character |
Normal data | Q | NOT LOWER – this is an expected value but not a lowercase character |
Normal data | & | NOT LOWER – this is not a lowercase character |
Boundary data | NOT LOWER – this is testing an empty string, which is always a good idea to test as odd things can happen |
Note that data entry such as flimsy will almost certainly return LOWER. This is partly because of the way that Python handles strings and characters as the same thing (in C# or VB.Net they are handled as different data types).
A way to deal with this would be to make sure that the user only entered a single character. You could do this by checking the length of the string they entered – this would also deal with the empty string entry. But there's absolutely no need to do this in an exam.
A note about copyright
The question text has been published openly on the web by AQA. That is copyrighted to them. The other words on this page are mine.
I'm using this here because the children I teach need to work on how they write exam answers – and the groups I published them for originally were cohorts massively impacted by COVID. I think, given that the questions have been published openly, that there is a fair-use educational rationale for putting them up here.
Note that I'm not putting them in a book, selling them on the TES, gaining any advertising revenue, or being paid in any other way for running this website. But I am aware that I'm in a copyright grey area. If that's a problem, contact me.