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
According to the author. Consider diverse and various domains of programming languages and applications.
elixir [45]

Answer:

A system programming language has low - level features that allow a software interface to write in an external device. Some computer uses computer languages such as PL/S, PL/I. This is an example of System Programming or Language programming.

Explanation:

The system language is a language used for system programming such as writing system software, which requires different development approaches when compared with application software.

System programming is the activity of the computer system. The characteristic of system programming when application programming produces software is that application that provides services to create software platforms.                    

                     

5 0
3 years ago
How do big organizations take back their data to be reviewed after a disaster?
Jet001 [13]
Here a 5 step recovery plan, I have been in IT for 8 years

1. Create a disaster recovery team.

The team will be responsible for developing, implementing, and maintaining the DRP. A DRP should identify the team members, define each member’s responsibilities, and provide their contact information. The DRP should also identify who should be contacted in the event of a disaster or emergency. All employees should be informed of and understand the DRP and their responsibility if a disaster occurs.

2. Identify and assess disaster risks.

Your disaster recovery team should identify and assess the risks to your organization. This step should include items related to natural disasters, man-made emergencies, and technology related incidents. This will assist the team in identifying the recovery strategies and resources required to recover from disasters within a predetermined and acceptable timeframe.

3. Determine critical applications, documents, and resources.

The organization must evaluate its business processes to determine which are critical to the operations of the organization. The plan should focus on short-term survivability, such as generating cash flows and revenues, rather than on a long term solution of restoring the organization’s full functioning capacity. However, the organization must recognize that there are some processes that should not be delayed if possible. One example of a critical process is the processing of payroll.

4. Specify backup and off-site storage procedures.

These procedures should identify what to back up, by whom, how to perform the backup, location of backup and how frequently backups should occur. All critical applications, equipment, and documents should be backed up. Documents that you should consider backing up are the latest financial statements, tax returns, a current list of employees and their contact information, inventory records, customer and vendor listings. Critical supplies required for daily operations, such as checks and purchase orders, as well as a copy of the DRP, should be stored at an off-site location.

5. Test and maintain the DRP.

Disaster recovery planning is a continual process as risks of disasters and emergencies are always changing. It is recommended that the organization routinely test the DRP to evaluate the procedures documented in the plan for effectiveness and appropriateness. The recovery team should regularly update the DRP to accommodate for changes in business processes, technology, and evolving disaster risks.



summary :an organization must develop a recovery team to create a disaster recovery plan that includes identifying and assessing disaster risks, determining critical applications, and specifying backup procedures. Other procedures may be included in the plan based on the organization. The recovery team and organization must then implement the DRP and follow through on the plan procedures. The DRP should be continually tested and maintained to consistently prepare the organization for evolving disasters and emergencies.
4 0
3 years ago
7.12 LAB: Even/odd values in a list
Korvikt [17]

The odd values in a list can be calculated by knowing the first and last number, whereas even numbers can be divided by two and the remainder is zero (0).

<h3>What are even numbers and odd numbers?</h3>

The even numbers can be found in a list because they are divisible by two and the remainder of this equation is always zero (0).

Conversely, odd numbers are those that cannot be divided exactly into exact entire numbers (e.g., 3, 5, etc).

The odd numbers in a list can be calculated by the equation ON (odd numbers): n/2 × [f + g], where 'f' is the first number and 'g' is the last number.

In conclusion, the odd values in a list can be calculated by knowing the first and last number, whereas even numbers can be divided by two and the remainder is 0.

Learn more about odd numbers here:

brainly.com/question/2263958

#SPJ1

4 0
2 years ago
Give two examples of safe, professional usernames. (1-2 sentences)
erastovalidia [21]

Answer:

Safe username

Explanation:

OKNGR$#1133

PLMOKNG^&*89

5 0
2 years ago
0 % 3? Is it 0 or undefined? (% is mod)
avanturin [10]
It’s 0


it’s like 3 times 0
6 0
3 years ago
Other questions:
  • Write a program that requests a state abbreviation as input and displays the justices appointed from that state. The justices sh
    6·1 answer
  • The a0 is the part of the central processing unit that performs arithmetic calculations for the computer.
    8·1 answer
  • In the file MajorSalary, data have been collected from 111 College of Business graduates on their monthly starting salaries. The
    15·1 answer
  • Jawana has been working on a paper for her Anatomy class for weeks. One day her little brother was on her computer and accidenta
    14·1 answer
  • Which of the following is NOT a useful strategy when making an informed purchase ?
    7·1 answer
  • What is the default font style of “Title” box in MS PowerPoint 2013?
    8·1 answer
  • Write programs in python to display “Valid Voter”. (condition : age of person should be
    15·1 answer
  • By what decade were books readily available to the public across the United States and Europe?
    7·1 answer
  • Juan is a network administrator and must set up a VPN for his company's network. To allow safe communication, he should
    13·1 answer
  • Briefly explain the emerging trends in micro computer technology in relation to size
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!