1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Juli2301 [7.4K]
3 years ago
6

Python

Computers and Technology
1 answer:
andreyandreev [35.5K]3 years ago
8 0

Answer:

<h2>1)   </h2>

h = 19  # h is already assigned a positive integer value 19

i = 1  # used to calculate perfect square

q = 0   # stores the sum of the perfect squares

while q < h:  

# this loop executes until value of number of perfect squares is less than h

   q = q + (i*i)  # to calculate the sum of perfect squares

   i = i + 1  # increments i by 1 at every iteration

print(q) # displays the sum of perfect squares

Output:

30

Explanation:

Here we see that the sum of the perfect square is printed in the output i.e. 30. If we want to assign value 4 to q then we should alter the code as  following:  

h = 19

i = 1

sum_of_ps = 0

q=0

while sum_of_ps < h:

   sum_of_ps = sum_of_ps + (i*i)

   q = q + 1

   i = i + 1  

print(q)  

If you want to take input from the user and also display the perfect squares in output you can use the following code:

h = int(input('Enter the value of h: ')) #takes value of h from user

i = 1

sum_of_ps = 0

q=0

while sum_of_ps < h:

   sum_of_ps = sum_of_ps + (i*i)

   print(i*i) #displays the perfect squares of h

   q = q + 1

   i = i + 1    

print(sum_of_ps)   #displays sum of perfect squares

print(q) #displays number of perfect squares whose value is less than h

Output:

1

4

9

16

30

4

<h2>2)</h2>

# k and m are already assigned positive integers 10 and 40

k = 10  

m = 40  

i = 1  # i is initialized to 1

q = 0  # q stores the number of perfect squares between k and m

while i*i < m:  # loop computes perfect square of numbers between k and m

   if i*i > k:          

       q = q + 1  # counts the number of perfect squares

   i = i + 1  #increments the value of i at each iteration

print (q) # prints the no of perfect squares between k and m

If you want to display the perfect squares too use , add print(i*i) statement after if statement  if i*i > k:        

Output:

3

<h2>3)</h2>

def Fibonacci(n):  # method Fibonacci which has an integer parameter n

   if n <= 1:  # if the value of n is less than or equals to 1

       result = n  # stores the value of n into result

   elif n > 1:  # else if the value of n is greater than 1

       result = Fibonacci(n-1) + Fibonacci(n-2)  

# calls Fibonacci method recursively to associate nth value of Fibonacci #sequence with variable result

   return result     #returns the final value stored in result variable

print(Fibonacci(8))

#calls Fibonacci function and passes value 8 to it

Output:

21

You might be interested in
What is the home enabled button view id in toolbar in android?
DaniilM [7]
The home enabled button takes you back to your main screen
6 0
3 years ago
What Windows Server 2016 edition is used for volume licensing customers in academic markets and allows multiple users to share o
Lunna [17]

Answer:

The correct answer to the following question will be Option D (Data Center).

Explanation:

Data centers are essentially clustered areas where computer and networking infrastructure is focused to gather, store, process, transmit or allow endless supplies of data.

Windows Server 2016 is released in three versions (Microsoft for Windows Server 2016 no longer provides a base version as it has been in Windows Server 2012):

  • Standard
  • Essentials
  • Data center

With a large number of integrated environments, the Data center is suitable for all organizations for heavy IT workload criteria.

Therefore, Option D is the right answer.

6 0
4 years ago
Why are most minicomputers no longer used​
Svet_ta [14]

Answer:

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Explanation:

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as sma

7 0
4 years ago
Identify the tools on the boxes. write the answer
Gnom [1K]

Answer:

im going off of what i know =( 2 screw driver 3 zip ties 5 needle nose plyers 8 can air

Explanation:

5 0
3 years ago
How do I install free premium iOS apps?
Wittaler [7]

Answer:

you go to the ios store

Explanation:

5 0
3 years ago
Other questions:
  • If you delete a file from removable media, it is stored in the recycle bin where you can recover it until you empty the recycle
    13·1 answer
  • What is the code range for the integumentary system subsection in the cpt coding manual?
    6·1 answer
  • You csn access various sites on the www by using hyperlinks or by
    7·1 answer
  • Given the network 192.168.100.0/24, we are going to segment this network into two subnets, Subnet A and Subnet B. The hosts requ
    10·1 answer
  • What were the first microblogs known as?
    13·2 answers
  • Run a Monte Carlo simulation on this vector representing the countries of the 8 runners in this race:
    7·1 answer
  • To calculate subtotal for a table, the first step is to use the ____ button on the table tools design tab.
    15·1 answer
  • How do I log into PGCPS?
    14·1 answer
  • What is the value of numX when this program is executed? if 3 &lt; 5 and 8 != 3: numX = 3 else: numX = 7
    13·2 answers
  • Write a python program to print the square of all numbers from 0 to 10.
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!