Answer:
import math
#Initialize tolerance
tolerance = 0.000001
def newton(x):
""" Returns the square root of x """
#Performs the successive approximations
estimate = 1.0
while True:
estimate = (estimate + x / estimate) / 2
difference = abs(x - estimate ** 2)
if difference <= tolerance: # Break out of loop if difference is less than tolerance
break
return estimate # While the difference value is > TOLERANCE, the process continues
def main():
"""Allows the user to obtain square roots."""
while True:
#Receive the input number from the user
x = input("Enter a positive number or enter/return to quit: ")
if x == "": #if user presses "Enter" then exit the program
break # Otherwise, continue the process of allowing new numbers
x = float(x)
#Output the result
print("The programs estimate of the square root of ", x, "is ", round(newton(x),2))
print("Python's estimate: ", math.sqrt(x))
main()
Complete Question:
Firewall implementation and design for an enterprise can be a daunting task. Choices made early in the design process can have far-reaching security implications for years to come. Which of the following firewall architecture is designed to host servers that offer public services?
a) Bastion Host
b) Screened subnet
c) Screened host
d) Screened
Answer:
b) Screened subnet
Explanation:
In Computer science, Firewall implementation and design for an enterprise can be a daunting task. Choices made early in the design process can have far-reaching security implications for years to come.
Screened subnet firewall architecture is designed to host servers that offer public services.
In network security and management, one of the network architecture used by network engineers for the prevention of unauthorized access of data on a computer is a screened subnet. A screened subnet can be defined as a network architecture that uses a single firewall with three screening routers as a firewall.
<em>A screened subnet is also known as a triple-homed firewall, this is because it has three (3) network interfaces;</em>
1. Interface 1: it is known as the external or access router, which is a public interface and connects to the global internet.
2. Interface 2: it is known as the demilitarized zone or perimeter network, which acts as a buffer and hosted public servers (bastions host) are attached herein.
3. Interface 3: it is known as the internal router, which is a subnet that connects to an intranet.
<em>The screened subnet when properly configured helps to prevent access to the internal network or intranet. </em>
def average_value_in_file(filename):
f = open(filename)
total = 0
count = 0
for x in f.read().splitlines():
total += int(x)
count += 1
return total/count
print(average_value_in_file("input.txt"))
I used an input file that looks like this:
1
1
1
1