Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Having trouble with a python problem: Assume there is a variable, h already associated with a positive integer value. Write the code necessary to count

Having trouble with a python problem:

Assume there is a variable, h already associated with a positive integer value. Write the code necessary to count the number of perfect squares whose value is less than h, starting with 1. (A perfect square is an integer like 9, 16, 25, 36 that is equal to the square of another integer (in this case 3*3, 4*4, 5*5, 6*6 respectively).) Assign the sum you compute to a variable q For example, if h is 19, you would assign 4 to q because there are perfect squares (starting with 1) that are less than h are: 1, 4, 9, 16.

Here is my current code:

i=1

q=0

while ((i*i)

q=(i*i)-q

i+=1

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions

Question

56.If then nd E(X) and V(X) by differentiating a. MX(t) b. RX(t)

Answered: 1 week ago

Question

state what is meant by the term performance management

Answered: 1 week ago