project-4a modify the binary search function from the exploration so that, instead of returning -1 when the target value is not in the list, raises a targetnotfound exception (you'll need to define this exception class). otherwise it should function normally. name this function bin except. the file must be named: bin except.py

Answers

Answer 1

To modify the binary search function from the exploration, you can create a new function named `bin_except` in a file called `bin_except.py`. This modified function will raise a `TargetNotFoundException` instead of returning -1 when the target value is not found in the list.

To define the `TargetNotFoundException` exception class, you can use the following code:

```
class TargetNotFoundException(Exception):
   pass
```

Then, in the `bin_except` function, you can implement the modified binary search logic. If the target value is found, the function should return its index as before. However, if the target value is not found, the function should raise the `TargetNotFoundException` exception.

To knnow more about binary visit:

brainly.com/question/32556352

#SPJ11


Related Questions

When should you use a relative hyperlink? group of answer choices when you need to link to a web page internal to your website always, the w3c prefers

Answers

When you need to link to a web page internal to your website, you should use a relative hyperlink. A relative hyperlink is a type of hyperlink that specifies the path to a file or web page relative to the current page. It is particularly useful when you want to link to pages within the same website.

1. Identify the web page or file you want to link to within your website.
2. Determine the relationship between the current page and the page you want to link to. For example, if the current page is in the same directory as the target page, the relationship is considered "sibling".
3. Construct the relative path by navigating through the directory structure. Use "../" to move up one level in the directory hierarchy.
4. Insert the relative path as the URL in the hyperlink code on your web page. For example, link text.
5. Test the hyperlink to ensure it works correctly.

Using a relative hyperlink allows you to easily update or move your website without breaking the links within it. It also helps maintain a clean and organized file structure.

In summary, you should use a relative hyperlink when you need to link to a web page internal to your website. By following the steps mentioned above, you can create effective and flexible links within your website.

Learn more about hyperlink code: https://brainly.com/question/33442132

#SPJ11

Which action should you choose for a virtual machine within the actions pane in order to obtain the virtual machine connection window?

Answers

To obtain the virtual machine connection window, you should choose the "Connect" action for the virtual machine within the actions pane.

The "Connect" action within the actions pane is specifically designed to establish a connection with a virtual machine. By selecting this action, you initiate the process of establishing a remote desktop session or console connection to the virtual machine. The virtual machine connection window provides the interface through which you can interact with the virtual machine's operating system and applications. It allows you to view and control the virtual machine's desktop environment, access files and folders, and perform administrative tasks. Choosing the "Connect" action is the appropriate step to initiate the virtual machine connection window and gain remote access to the virtual machine.

To know more about virtual machine click the link below:

brainly.com/question/31674424

#SPJ11

if your network administrator suggests taking two network connections and having a server connect the two networks and make a larger network as a result, what is the appropriate term that describes this

Answers

The appropriate term that describes the scenario where a server connects two networks to create a larger network is called "network bridging" or "network bridging configuration."

Network bridging involves combining multiple networks into one larger network, allowing devices from different networks to communicate with each other seamlessly.

This is typically achieved by configuring the server to act as a bridge or switch, forwarding data packets between the connected networks. Network bridging can enhance network scalability, improve performance, and enable easier management of connected devices.

Learn more about network at

https://brainly.com/question/13055965

#SPJ11

you have been receiving a lot of phishing emails sent from the domain kenyan.msn.pl. links within these emails open new browser windows at youneedit.com.pl.

Answers

Phishing emails are malicious emails that are designed to trick recipients into revealing sensitive information or downloading malware. In this case, you have been receiving phishing emails from the domain kenyan.msn.pl. These emails contain links that open new browser windows at youneedit.com.pl.

To protect yourself from these phishing emails, here are a few steps you can take:

1. Be cautious: Be skeptical of any unsolicited emails, especially those asking for personal or financial information. Do not click on suspicious links or download attachments from unknown senders.

2. Check the email address: Pay attention to the email address of the sender. In this case, the domain kenyan.msn.pl is not a legitimate domain associated with MSN or Microsoft. This is a red flag indicating a potential phishing attempt.

3. Verify the URLs: If you receive an email with links, hover your mouse over the links without clicking on them. In this case, the links in the phishing emails open new browser windows at youneedit.com.pl, which is also not a trusted or reputable domain. This is another sign that the emails are likely phishing attempts.

4. Report and delete: If you receive phishing emails, report them to your email service provider or IT department. They can take appropriate action to block the sender and prevent others from falling victim to the scam. Remember to delete the emails from your inbox and trash folder to avoid accidentally clicking on the malicious links.

By following these steps, you can protect yourself from falling victim to phishing emails and avoid compromising your personal information or computer security.

To know more about Phishing emails visit:

https://brainly.com/question/30265193

#SPJ11

you've found signs of unauthorized access to a web server, and on further review, the attacker exploited a software vulnerability you didn't know about. on contacting the vendor of the server software, you learn that it's a recently discovered vulnerability, but a hotfix is available pending the next software update. what kind of vulnerability did they exploit? choose the best response.

Answers

The vulnerability that was exploited in this scenario is a software vulnerability.

In this situation, you have discovered signs of unauthorized access to a web server. Upon further investigation, it is revealed that the attacker was able to exploit a software vulnerability that you were not previously aware of. When you contacted the vendor of the server software, you were informed that this vulnerability had recently been discovered. Although a permanent fix is pending the next software update, a temporary solution in the form of a hotfix is available.

By exploiting this software vulnerability, the attacker was able to gain unauthorized access to the web server. It is important to promptly apply the hotfix provided by the vendor to mitigate the risk and prevent any further unauthorized access. Regularly updating software and promptly applying patches and fixes is crucial in maintaining the security of your web server.

Know more about software vulnerability, here:

https://brainly.com/question/31170408

#SPJ11

write a function that takes one integer as its parameter. the function should return true if the inputted integer is even, and false if it is odd. run the function with the integers 5 and 10. print out the results.

Answers

In this code, the is_even function checks if the inputted number is divisible by 2 without any remainder. If it is, the function returns True, indicating that the number is even. Otherwise, it returns False, indicating that the number is odd.

Python function that takes an integer as a parameter and returns True if the inputted integer is even, and False if it is odd:

def is_even(number):

   if number % 2 == 0:

       return True

   else:

       return False

# Test the function with integers 5 and 10

number1 = 5

number2 = 10

result1 = is_even(number1)

result2 = is_even(number2)

print(f"The number {number1} is even: {result1}")

print(f"The number {number2} is even: {result2}")

output:

The number 5 is even: False

The number 10 is even: True

We then call the function with the integers 5 and 10 and store the results in result1 and result2 variables, respectively. Finally, we print out the results indicating whether each number is even or not.

Learn more about integer parameter https://brainly.com/question/30292191

#SPJ11

Select the loop that computes the average of an array of integers called iArray that has been previously declared and initialized. Store the result in a variable of type integer called iAverage that has been previously declared and initialized to zero.

Answers

To compute the average of an array of integers called `iArray`, you can use a for loop. Here's an example of how you can do it:

```java
int iSum = 0;
int iAverage;
int arrayLength = iArray.length;

for (int i = 0; i < arrayLength; i++) {
   iSum += iArray[i];
}

iAverage = iSum / arrayLength;
```

In this code, we initialize a variable `iSum` to store the sum of all the elements in `iArray`. We also initialize `arrayLength` to store the length of `iArray`.

Then, using a for loop, we iterate through each element in `iArray` and add it to `iSum`. After the loop, `iSum` will contain the sum of all the elements in the array.

Finally, we calculate the average by dividing `iSum` by `arrayLength` and store the result in the `iAverage` variable.

Make sure to replace `iArray` with the name of your actual array variable and adjust the variable types accordingly.

To know more about average of an array of integers visit:

https://brainly.com/question/33343017

#SPJ11

use the computer to watch high-definition movies on a blu-ray player. connect their monitor to the computer using a connection designed for high-definition content.

Answers

To watch high-definition movies on a Blu-ray player using a computer, you can connect your monitor to the computer using a connection designed for high-definition content.

Here's a step-by-step guide:

1. Check the available ports on your computer and monitor. Look for HDMI, DisplayPort, or DVI ports. These are common connections for high-definition content.

2. If your computer has an HDMI port, and your monitor also has an HDMI port, you can simply use an HDMI cable to connect the two. HDMI cables transmit both audio and video signals, so you will be able to enjoy high-definition movies with both audio and video.

3. If your computer has a DisplayPort and your monitor has a DisplayPort as well, you can use a DisplayPort cable to connect them. DisplayPort also supports high-definition content and provides excellent video quality.

4. In case your computer has a DVI port and your monitor has a DVI port too, you can connect them using a DVI cable.

5. If your computer and monitor do not have matching ports, you may need an adapter.

To know more about HDMI visit:

https://brainly.com/question/8361779

#SPJ11

Explain as a list of steps what really happens behind the scene when the run button is pressed alice3.

Answers

When the run button is pressed in Alice 3, the following steps are executed: parsing, compiling, and interpreting the code.

1. Parsing: The first step is parsing, where the code is analyzed and divided into meaningful components such as statements, expressions, and variables. This ensures that the code is syntactically correct and follows the rules of the programming language.
2. Compiling: Once the code is parsed, it is then compiled into machine-readable instructions. This involves translating the high-level code into a lower-level representation that can be executed by the computer's processor. The compiled code is usually stored in an executable file.
3. Interpreting: After compilation, the code is interpreted by the computer. The interpreter reads the compiled instructions and executes them one by one. It performs the necessary computations and produces the desired output. During interpretation, any errors or exceptions are handled, and the program's behavior is observed.

Know more about parsing here:

https://brainly.com/question/31389744

#SPJ11

The use of a computer that accepts both analog and digital input signals from all parts of an hvac or automated building system is called:_________

Answers

"The use of a computer that accepts both analog and digital input signals from all parts of an HVAC or automated building system is called" is a "Building Automation System (BAS)" or "Building Management System (BMS)."

A Building Automation System (BAS) or Building Management System (BMS) is a computer-based control system that integrates and manages various subsystems within a building, such as HVAC (heating, ventilation, and air conditioning), lighting, security, and fire safety systems. The BAS/BMS allows for the centralized monitoring and control of these subsystems, enabling the efficient and effective management of the building's operations.

The key feature of a BAS/BMS is its ability to accept both analog and digital input signals from all parts of an HVAC or automated building system. Analog signals are continuous and can represent variables like temperature, pressure, or humidity, while digital signals are discrete and represent binary information.

By accepting both types of signals, the BAS/BMS can gather data from sensors and devices throughout the building and use that information to make intelligent decisions regarding the operation of the building systems. For example, it can adjust the HVAC settings based on temperature and occupancy data to optimize energy efficiency.

In summary, a Building Automation System (BAS) or Building Management System (BMS) is the computer that accepts both analog and digital input signals from all parts of an HVAC or automated building system, allowing for centralized control and management.

Learn more about optimize energy efficiency: https://brainly.com/question/30796955

#SPJ11

A favorite pastime of information security professionals is ____, which is a simulation of attack and defense activities using realistic networks and information systems.

Answers

A favorite pastime of information security professionals is called "red teaming," which is a simulation of attack and defense activities using realistic networks and information systems.

This practice helps to identify vulnerabilities and improve the overall security posture of an organization. Red teaming involves skilled professionals, known as red team members, who play the role of attackers to uncover weaknesses, while the blue team members defend against these simulated attacks.

It is a proactive approach to security testing and enhances the readiness of organizations against real-world threats.

Which of the following protocols will best protect the Confidentiality and Integrity of network communications

Answers

The protocol that will best protect the Confidentiality and Integrity of network communications is Transport Layer Security (TLS).

What is Transport Layer Security (TLS) and how does it ensure the Confidentiality and Integrity of network communications?

Transport Layer Security (TLS) is a cryptographic protocol that provides secure communication over a network. It ensures the Confidentiality and Integrity of network communications through the following mechanisms:

Encryption: TLS uses symmetric and asymmetric encryption algorithms to encrypt data transmitted between a client and a server. This ensures that the data remains confidential and cannot be read by unauthorized parties.

Authentication: TLS includes mechanisms for server authentication, where the server presents a digital certificate to the client to prove its identity. This prevents man-in-the-middle attacks and ensures that the client is communicating with the intended server.

Integrity Check: TLS uses message integrity checks, such as the use of hash functions, to ensure that the data has not been tampered with during transmission. This guarantees the integrity of the data and detects any modifications.

Perfect Forward Secrecy: TLS supports Perfect Forward Secrecy (PFS), which ensures that even if a server's private key is compromised, past communications remain secure. PFS generates a unique session key for each session, protecting the confidentiality of the data.

Learn more about Transport Layer Security

brainly.com/question/33340773

#SPJ11

Write function called read_rand_file(file_name) The function will read the random numbers from file_name display the total of the numbers display the total count of random numbers read form the file

Answers

To write a function called `read_rand_file(file_name)`, which reads random numbers from a given file, displays the total of the numbers, and displays the total count of random numbers read from the file, you can follow the steps below:

1. Open the file with the given `file_name` using the `open()` function in Python. 2. Read the contents of the file using the `read()` method and store it in a variable, let's say `file_contents`. 3. Split the `file_contents` into individual numbers using the `split()` method, assuming that the numbers are separated by spaces or new lines. Store the resulting list in a variable, such as `numbers_list`. 4. Calculate the total of the numbers in `numbers_list` using the `sum()` function and store it in a variable, for example `total_sum`. 5. Determine the total count of random numbers read from the file by using the `len()` function on `numbers_list` and store it in a variable, like `count_numbers`. 6. Display the `total_sum` and `count_numbers` using the `print()` function.

Here's an example implementation of the `read_rand_file()` function:

```python
def read_rand_file(file_name):
   # Open the file
   file = open(file_name, 'r')

   # Read the contents of the file
   file_contents = file.read()

   # Split the contents into individual numbers
   numbers_list = file_contents.split()

   # Calculate the total sum of the numbers
   total_sum = sum(map(int, numbers_list))

   # Determine the count of random numbers
   count_numbers = len(numbers_list)

   # Display the total sum and count of random numbers
   print("Total sum of numbers:", total_sum)
   print("Total count of random numbers:", count_numbers)

   # Close the file
   file.close()
```

To use this function, simply call it with the desired file name as the argument. For example:

```python
read_rand_file("random_numbers.txt")
```

Make sure to replace "random_numbers. txt" with the actual file name you want to read from.

To know more about function visit:

https://brainly.com/question/32270687

#SPJ11

Other Questions
what steps are always part of both the process of technological design and the process of scientific investigation? check all that apply. A police car is traveling east at 40.0 m/s along a straight road, overtaking a car ahead of it moving east at 30.0 m/s . The police car has a malfunctioning siren that is stuck at 1000 Hz. (b) What is the wavelength in front of the police car? an organism that can synthesize all of its organic components from co2 using energy from the sun is a Solve the system using equal values method. 5x-23=2 1/2-3 1/2x i think y=5x-23 y=2 1/2-3 1/2x The ___ the forces, the ___ the expected competitive intensity, which in turn limits the industrys profit potential. 13. a client has been diagnosed with major depressive episode. after treatment with fluoxetine (prozac), the client exhibits pressured speech and flight of ideas. based on this symptom change, which physician action would the nurse anticipate? 1. increase the dosage of fluoxetine. The dimensions of a regulation tennis court are 27 feet by 78 feet. The dimensions of a table tennis table are 152.5 centimeters by 274 centimeters. Is a table tennis table a dilation of a tennis court? If so, what is the scale factor? Explain. if your network administrator suggests taking two network connections and having a server connect the two networks and make a larger network as a result, what is the appropriate term that describes this draw a possible curve for the population several generations later if the population has stabilizing selection. Repeat the two constructions for the type of triangle.Acute you have been receiving a lot of phishing emails sent from the domain kenyan.msn.pl. links within these emails open new browser windows at youneedit.com.pl. two immune cell subsets are implicated by these data as important regulators of hiv replication and the rate of disease progression? __________ correlation between two variables means that as scores on one variable increase, then scores on another variable also increase. parents who choose cochlear implant surgery for their children are more often than not left vulnerable to rely on the professionals involved in the implantation process. How much work must be done by a system heated with 50 J if the goal was to reduce its internal energy by 15 J 3. about 5% of the population has arachnophobia 1, which is fear of spiders. consider a random sample of 28 people and let x be the number of people in the sample who are afraid of spiders. a) carefully explain why x is a binomial random variable. b) find the probability that exactly 5 people have arachnophobia. (show calculations for b - c!) c) find the probability that at most one person has arachnophobia. d) find the probability that at least two people have arachnophobia. most pregnancies are full term, but some are preterm (less than 37 weeks). of those that are preterm, they are classified as early (less than 34 weeks) and late (34 to 36 weeks). a report examined those outcomes for one year, broken down by age of the mother. is there evidence that the outcomes are not independent of age group? 31 year old g3p0 woman at 27 weeks gestation is managed expectantly for preeclampsia with severe features Hich social class was made up of children who were born in the spanish new world to parents who had emigrated from spain? Which balance training exercise is part of the second stage of balance training that uses dynamic, eccentric, and concentric movement of the balance leg through a full range of motion?