Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Basically, I did 3.(a) and my work is for n in [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]: square = n**2 print(n,squared is, square) But I'm having problems with 3.(b), 3.(c),

image text in transcribed

Basically, I did 3.(a) and my work is

for n in [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]:

square = n**2

print(n,"squared is", square)

But I'm having problems with 3.(b), 3.(c), and 3.(d) ....

Programming language: Python 3.8.1

Sincerely,

(1) (PT) Read and work through the examples in $3.1.1. Numbers $3.2 First Steps Towards Programming $4.1 if Statements $4.2. for Statements $4.3. The range () function (2) (NP) Read and work through the examples in For Loops SH Boolean Expressions (3) 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) Print the first 20 positive perfect squares using a for loop. (Note: This is the same as the square of the first 20 positive integers.) (b) Compute the last digit of each of the first 20 positive perfect squares. You can get the last digit of a using a % 10. As before, use a for loop. (c) Make a conjecture about the digits that can never arise as the last digit of a positive perfect square. Use complete sentences. (d) Verify your conjecture for the first 10.000 positive perfect squares. To avoid human error, use a for loop with an if statement that tells you when the con- jecture fails. Print the statement Beginning verification... before the for loop and the statement 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management System MCQs Multiple Choice Questions And Answers

Authors: Arshad Iqbal

1st Edition

1073328554, 978-1073328550

More Books

Students also viewed these Databases questions