Answer:
class MarblesBoard(object):
def __init__(self, seq):
self.seq = list(seq)
def switch(self):
temp = self.seq[0]
self.seq[0] = self.seq[1]
self.seq[1] = temp
def rotate(self):
temp = self.seq[0]
for i in range(1, len(self.seq)):
self.seq[i-1] = self.seq[i]
self.seq[-1] = temp
def is_solved(self):
for i in range(len(self.seq)):
if i != self.seq[i]:
return False
return True
def __str__(self):
return ' '.join(list(map(str,self.seq)))
def __repr__(self):
return ' '.join(list(map(str,self.seq)))
class Solver(object):
def __init__(self, board):
self.board = board
def solve(self):
steps = 0
while not self.board.is_solved():
if self.board.seq[0] > self.board.seq[1] and self.board.seq[0] != len(self.board.seq) - 1:
self.board.switch()
else:
self.board.rotate()
print(self.board)
steps += 1
print('Total steps:', steps)
Explanation:
The Python class MarblesBoard creates an object of the board game used in the Solver class object instance and it holds data or attributes of the player piece movement and the magic methods (__str__ and __repr__). The Solver object gets the switch and rotate movementt of the player and displays the total steps at the end of the game.
Answer:
Replace the comment with:
maxSum =FindMax(numA,numB)+FindMax(numY,numZ);
Explanation:
Required
The statement to add up the two maximum from the functions
To do this, we have to call FindMax for both arguments i.e.
FindMax(numA,numB) and FindMax(numY,numZ) respectively
Next, use the + sign to add up the returned value.
So, the complete statement is:
maxSum =FindMax(numA,numB)+FindMax(numY,numZ);
<em>See attachment for complete program</em>
The complete question rather reads;
DRU is a small brokerage house that enables its clients to buy and sell
stocks over the Internet, as well as place traditional orders by phone or Fax. DRU has just decided to install a new e-mail package. One vendor offering an SMTP-based two-tier client-server architecture. The second vendor is offering a Web-based e-mail architecture. DRU doesn't understand either one but thanks the Web-based one should be better because, in their words, "the Web is the future".
<u>(a) Briefly explain to DRU management, in layperson's terms, the difference between the two.</u>
<u>(b) Outline the pros and cons of the two alternatives and </u>
<u>(c) Recommend to DRU about which is better</u>
<u>Explanation:</u>
a) SMTP stands for Simple Mail Transfer Protocol. Thus, put simply an SMTP-based two-tier client-server architecture is a package that involves using a client-server provider like Outlook. This implies that Outlook provides the client with his own unique PO Box (server) so to speak.
While the Web-based e-mail architecture enables the DRU access to online mail platforms like G-mail with little server customisation features.
b. The Web-based e-mail architecture is good for personal email activities because of its ease of operation, however, it does not provide top security and customisation features. While an SMTP-based two-tier client-server architecture allows for unique server customisation with added security features as well be suitable for larger organisational work. Although a disadvantage is that it may cost more and quite a complex process to learn.
c) Since DRU is a growing firm the SMTP-based two-tier client-server architecture would be recommended as this would provide it will efficient customer service delivery.
Blue<span>: Parking is permitted only for a disabled person or a driver of a disabled person. </span>
Answer:
Option c: Heuristic
Explanation:
Heuristic scanning is a form of computer virus detection analysis that screen for the suspicious characteristic of the program which maybe a virus. Heuristic scanning is designed to detect those new computer virus, unknown virus or the modified version of the known virus.
To perform heuristic scanning, a weigh-based evaluation algorithm will be adopted to estimate the likelihood of the current scanned program behaves like a virus which can pose a computer threat. If it exceeds a threshold level, an alarm will be triggered.