Question: Write a script that solves the following problems. For each problem, print the problem number before the answer to make it easier to grade. (

Write a script that solves the following problems. For each problem, print the problem
number before the answer to make it easier to grade.
(a) Write a function squares(m) that prints the first m positive perfect squares using a
for loop. (Note: This is the same as the square of the first m positive integers.)
(b) Use your function squares to print the first 20 positive perfect squares.
(c) Write a function squares_last(m) that computes and prints the last digit of each of
the first m positive perfect squares. You can get the last digit of a using a %10. As
before, use a for loop.
(d) Use your function squares_last to print the fist digit of the first 20 positive perfect
squares.
(e) Make a conjecture about the digits that can never arise as the last digit of a positive
perfect square. Use complete sentences.
(f) Write a function verify(m) that verifies your conjecture for the first m perfect squares.
To avoid human error, use a for loop with an if statement that tells you when the
conjecture fails.
Print Beginning verification... before the for loop.
Print Verification complete. at the end of the for loop.
Print Conjecture is false! if you find a counterexample to your conjecture
in the for loop.
(g) Verify your conjecture for the first 10,000 positive perfect squares.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!