Week 4 Programming Written
Week 4 Programming Written
times = 5
print ("## "*times) ## ## ## ## ##
2. Assuming that x = 11, y = 6, z = 2, c = 'a', d = 'z', what are the values of the expressions in the
following table:
Value of expression
True
False
True
True
True
True
True
Type Error
True
‘e’ meaning True
3. The code below determines if a given number is small, medium, large or out of range. Correct the
errors that exist. After the correction, what is printed if you input 7?
Eg.
4. What is the difference in the logic of the following two sets of code:
6. You are writing a Python program to determine if an applicant qualifies for admission into NTU.
The selection uses two criteria: academic result and aptitude test. The academic result is a score in
the range 0-100 and the aptitude test is awarded one of these letter grades: A, B, C, D and E. A
candidate who satisfies one of the following two criteria qualifies:
• Academic score greater than or equal to 75 with aptitude grade of A, B, or C
• Academic score greater than or equal to 60 with aptitude grade of A only.
Your program stores the academic score in an integer variable called S and the aptitude grade in a
string variable called G. Write a Boolean expression in one line that returns True if an applicant.
qualifies based on the above criteria and False otherwise. (Do not write multiple statements.)