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
alexgriva [62]
3 years ago
7

Encapsulate the following Python code from Section 7.5 in a function called my_sqrt that takes a as a parameter, chooses a start

ing value for x, and returns an estimate of the square root of a.
while True:
a. y = (x + a/x) / 2.0
b. if y == x:
c. break
d. x = y
Computers and Technology
1 answer:
Elden [556K]3 years ago
3 0

Answer:

def my_sqrt(a):

   while True:

       x = a

       y = (x + a / x) / 2

       if (y == x):

           break

       else:

           x = y

   print(x)

   return 0

my_sqrt(5)

Explanation:

The above is a function in Python, and the exact copy as code of what is being given in the question. Its a method to find out the square root of a number which is a here. The while loop has been used as being mentioned in the question, and the variables are defined and calculated as being stated.

You might be interested in
What are the limitations of the ASCII character set? State why it is limited in this way?
dedylja [7]
The problem with ASCII or extended ASCII is that the ASCII system can only represent up to 128 (or 256 for EASCII) different characters. The limitation on the number of character sets means representing character sets for several different language structures is not possible.
7 0
3 years ago
Andre is teaching a class without the software development cycle while teaching the analyst phase which task should Andre mentio
Delvig [45]

I have no idea sorry

7 0
3 years ago
Write a python coding to input ten random numerical vales to a list. And display the list. Use a loop structure to enter values.
Zarrin [17]

Answer:

000110011111000010010101001001

Explanation:

8 0
3 years ago
Write a modular program that allows the user to enter a word or phrase and determines whether the word or phrase is a palindrome
Ostrovityanka [42]

Answer:

import java.util.Scanner;

public class num10 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter a word");

       String word = in.nextLine();

       String reversed = "";

       //Get the length of the string entered

       int length = word.length();

       //Loop through the string and reverse th string

       for ( int i = length - 1; i >= 0; i-- )

           reversed = reversed + word.charAt(i);

       //Compare the two strings "word" and "reversed"

       if (word.equals(reversed))

           System.out.println(word+" is a palindrome");

       else

           System.out.println(word+" is not a palindrome");

   }

}

Explanation:

Since we know that a palindrome word is a word that reads the same forward and backward, The Idea here is:

  • To obtain a word from a user.  
  • Use a for loop to reverse the word and store in another variable
  • Use if....else to compare the two strings and determine if they are equal, if they are equal then the word is palindrome.
6 0
4 years ago
When you reboot your system, the computer follows startup instructions stored in this type of memory?
hram777 [196]
I think the word ur looking for is hard drive memory
3 0
3 years ago
Read 2 more answers
Other questions:
  • The statement print(words[len(words)]) will raise an exception. What should be placed in the blank so that this exception will b
    11·1 answer
  • Suppose Host A sends two TCP segments back to back to Host B over a TCP connection. The first segment has sequence number 90; th
    8·2 answers
  • how does modern information technology has affected society ?? Need help on how it has affected society
    10·1 answer
  • Which term is used to define the wires on a motherboard that move data from one part of a computer to another?
    13·1 answer
  • Write down the bit pattern to represent -3.75 assuming a version of this format, which uses an excess-16 format to store the exp
    14·1 answer
  • Question 4 (Worth 5 points)
    14·2 answers
  • Which of the following is NOT an example of one of the six primary ways businesses use the Internet?
    10·2 answers
  • A two-dimensional array has been defined to hold the quantity of each of 5 different healthy snack products sold in a tuckshop d
    10·1 answer
  • Which term means the push that makes electrons move in a wire?
    13·2 answers
  • Which computer language uses short words known as mnemonics for writing programs?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!