Coding to Analyse Data: Subprograms and Nested Loops
Grade 8 math worksheet · mathbonk.com/learn
Name: ______________________ Date: ____________
Look
| Answer | Tally marks |
|---|---|
| Pizza | IIII II |
| Sushi | IIII |
| Tacos | III |
| Other | II |
- How many people chose pizza?
- How many answers are there in all?
- What percent chose sushi, to the nearest whole percent?
Practice
- In a program, what is a named block that can be used again and again called?
- A counter starts at 0. What is it after repeat 3 [ repeat 4 [ add 1 to count ] ]?
- In a survey of 20 people, 8 chose pizza. What percent is that?
- Why does a counting loop contain an "if" block?
- A survey has 15 yes answers and 25 no answers. How many people were surveyed in all?
- How many lines does repeat 2 [ repeat 5 [ print "x" ]; new line ] print?
- Why test a program on a short list of data first?
- In a bag of 30 marbles, 9 are blue. What percent are blue?
- To turn counts into percents, what does the program do to each count?
- A loop goes through a list of 50 answers once. How many times does the loop run?
- True or false: a subprogram must be written separately for each choice being counted.
- Three classes each give 25 answers. How many answers are there in all?
Think it through
- Draw a flowchart for counting how many answers in a list say "yes".
- Explain why a program that counts answers should be tested on a short list first.
Challenge
- A counter runs repeat 3 [repeat 5 [add 2]]. What is the final count?
- In a list of 40 answers, 14 say "maybe". What percent is that?