Grade 7 - Python Grade - : DT Assessment Development Unit
Grade 7 - Python Grade - : DT Assessment Development Unit
Grade 7 - Python Grade - : DT Assessment Development Unit
Grade 7 - Python
Grade -
Student Name –
Student ID No. -
Task 1:
Complete the flowchart below to print the largest of two numbers:
1.1. Draw the missing shape for the decision statement. 1 mark
1.2. Draw the two missing arrows. 2 marks
1.3. Label the decision arrows with YES or NO. 2 marks
1.4. Complete the two output boxes with appropriate statements. 2 marks
Start
Read a and b
If a > b?
Stop
1d. Complete the following code in a new Python file to print the largest
of two numbers. Use the flowchart you have completed in 1c.
Save the program as “Task No – Student Name – Grade”.
1e. Run the code you have written in 1d. What is your output? 1 mark
Task 2:
The following program uses a for loop to calculate and print the age and year of the
user for the next 5 years.
1 #Ask the user for their age
2 age = input ("Enter your age:")
3 #Convert this to an integer
4 age = int(age)
5 #Ask the user for the current year
6 year = input ("Enter the current year:")
7 #Convert this to an integer
8 year = int(year)
2.1. Write the above code in a new Python file, save and run the code.
Did it work correctly? Answer “Yes” or “No”.
2 marks
2.2. Write a suitable comment in line number 9 for the for loop statement
used in the program above. 1 mark
Line 9:
Task 3: 5 marks
The program in Task 2 can also be written using a while loop.