WorksheetsLesson 7: Problem solving
Total questions: 7
Worksheet time: 4mins
An array is used to record number of students in a school from Grade 1 to Grade 6:
S=[31, 32, 35, 32, 28, 39]
James wants to know the number of students in Grade 4. How to get it?
S[0]
S[1]
S[2]
S[3]
An array is used to record number of students in a school from Grade 1 to Grade 6:
S=[31, 32, 35, 32, 28, 39]
James wants to know the total number of students in Grade 4 and 5, How to get it?
sum(S[3:4]
sum(S[3:5])
sum(S[4:5])
sum(S[4:5])
Number of students in a school from Grade 1 to Grade 6:
S=[31, 32, 35, 32, 28, 39]
James wants to use above code to get the average number of students in all Grades. What should be fill in ???
(a)
Students from Grade 1 to Grade 6:
S=[31, 32, 35, 32, 28, 39]
James wants to find out which Grade can be grouped into exactly 7 groups. What's the missing code above to achieve this?
(a)
Students from Grade 1 to Grade 6:
S=[31, 32, 35, 32, 28, 39]
James wants to find out which Grade can be grouped into exactly 2 groups and 4 groups. What's the missing code above to achieve this?
i%4 == 0
i%2 == 0 and i%4 == 0
Teach Tom wants to remove the 'ed' from the grading string when printing. What to fill in ???
0:-3
0:-2
1:-2
1:-3
Teach Tom wants to change 'Passed' to 'Passing' and 'Failed' to 'Failing' when printing. What to fill in ???
grade[0:-2]+'ing'
grade.replace('ed','ing')
grade[0:4] + 'ing'
