Loop Exercises
1. Write a program that asks user 7’s multiplication table from 1 to 10
a. In the beginning of the program, specify that the user will answer the questions
about 7’s multiplication table.
b. Ask user “What is i (increment it each time) times 7”
c. When the user answers correctly, the program outputs “Correct!”
d. If the answer is false, the program outputs the correct answer in a sentence.
e. The user can skip from the question by typing “skip”
i. When user types “skip”(the program skips that question), output is
“Skipped the question ”
f. The user can stop the program by typing “stop”
g. At the end of the program, output is “Finished”
Expected Outcome
You are going to answer questions from 7’s multiplication table
What is 1 times 7? 7
Correct!
What is 2 times 7?12
Correct answer is 14
What is 3 times 7?skip
Skipped question
What is 4 times 7?quit
Finished
CodeHS link herehttps://codehs.com/sandbox/id/new-sandbox-program-wnu2fD
2. In this part, you are going to modify the first question ( multiplication table).
a. Open a new codeHS
b. Copy and paste first program
c. Get random numbers for multiplication table (range can be from 1 to 10
inclusive)
i. Be careful about where to get random numbers
ii. To be able to use randint function to generate random numbers add
random module to your program
import random
iii. To use random numbers use random.randint(1, 11)
d. Other parts of the program will be the same with the first program.
codeHS link here:https://codehs.com/sandbox/id/new-sandbox-program-dJGMa5
3. Write an algorithm for a program to input the scores for 20 students in a class. The
output is the average score and the number of scores which is greater than 70.
codeHS link here:https://codehs.com/sandbox/id/new-sandbox-program-IeODfd