Jump to content

Featured Replies

The data in the table below has been collected by a teacher at the end of two unit assessments. Produce a subroutine for an algorithm that could be used to count the number of students who achieved a grade 8 in both assessments, the data is stored in parallel arrays and array indexing begins at 0

Ryan. 5. 5

Liam. 8. 8

Sophie. 5. 7

Micheal 3. 4

Robert 8. 8

Rebecca. 5. 3

You haven't said if the information in each line is all one string or in columns or what ?

In any case you need to start by telling us what you have done or think might be done.

Hint  : I would start with the last character in each line

May we assume 8 is the highest grade?

16 minutes ago, Potter1245 said:

data is stored in parallel arrays and array indexing begins at 0

I'll assume that you have two arrays containing 6 integers each:

5, 8, 5, 3, 8, 5 

and

5, 8, 7, 4, 8, 3 

As a stating point, do you know how to loop through arrays and use the index to access values? 

 

  • Author

8 is the highest grade, I don’t know how to loop guys, pls help

My daughter has asked me to answer this question as a dad I said I’ll try, I have no idea, but you guys are experts I’ll try anything 

31 minutes ago, Potter1245 said:

8 is the highest grade

Thanks! Now, let's say we have both the grades for a student, any idea how we could find out if both grades are 8? You could answer something in plain English like "if grade is this then do this..."

 

31 minutes ago, Potter1245 said:

I don’t know how to loop guys, pls help

A loop in this case means some way the algoritm uses to go through the array(s), step by step. A loop may be useful to check grades and do counting. 

Below is an example of a loop. It means: "go through the grades, one by one, and do something." In this case it prints the grades. 

grades = [5, 8, 5, 3, 8, 5 ]
for x in grades:
  print(x) 

The above can be copy-pasted into an online tool such as w3schools* if you want to test. 

 

*) in chis specific case you may start here: https://www.w3schools.com/python/trypython.asp?filename=demo_for

 

 

Edited by Ghideon
edit in progress

  • 3 weeks later...
On 2/27/2021 at 5:28 PM, Ghideon said:

The above can be copy-pasted into an online tool such as w3schools* if you want to test. 

..but OP didn't say the answer should be in Python...

Edited by Sensei

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.