Answer:
- def getCharacterForward(char, key):
- charList = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-
- if(len(char) > 1):
- return None
- elif(not isinstance(key, int)):
- return -1
- else:
- index = charList.find(char)
- if(index + key <= 25):
- return charList[index + key]
- else:
- return charList[(index + key)% 26]
-
- print(getCharacterForward("C", 4))
- print(getCharacterForward("X", 4))
Explanation:
Firstly, define a charList that includes all uppercase alphabets (Line 2). We presume this program will only handle uppercase characters.
Follow the question requirement and define necessary input validation such as checking if the char is a single character (Line 4). We can do the validation by checking if the length of the char is more than 1, if so, this is not a single character and should return None (Line 5). Next, validate the key by using isinstance function to see if this is an integer. If this is not an integer return -1 (Line 6 - 7).
Otherwise, the program will proceed to find the index of char in the charList using find method (Line 9). Next, we can add the key to index and use the result value to get forwarded character from the charList and return it as output (Line 11).
However, we need to deal a situation that the char is found at close end of the charList and the forward key steps will be out of range of alphabet list. For example the char is X and the key is 4, the four steps forward will result in out of range error. To handle this situation, we can move the last two forward steps from the starting point of the charList. So X move forward 4 will become B. We can implement this logic by having index + key modulus by 26 (Line 13).
We can test the function will passing two sample set of arguments (Line 15 - 16) and we shall get the output as follows:
G
B
Hello!
Four trillion bytsz will be expressed as "4T".
T stands for trillion.
In python:
total = 0
i = 0
while total <= 100:
number = int(input("Enter a number: "))
i += 1
total += number
print("Sum: {}".format(total))
print("Numbers Entered: {}".format(i))
Answer: True.
Explanation:
When a user wants to make a phone call, he needs to inform to the called party, that he wants to call him.
The only way to do this, is setting up a connection between the two phones, which is started by the calling party informing to the phone switch which is directly connected to, that he wants to make a call, picking up the phone, which modifies his connection state, making him available for calling.
The switch then signals him (sending him an audible call tone) so he can send the digits that identify the called party.
When the destination switch identifies the called user, signals him also (sending in this case a ringing tone).
When he picks up his phone, answering the call, the connection is set up, and both people can talk each other.
Without all this signaling process, it would be completely impossible to set up the call.
Answer:
A tape drive provides sequential access storage, unlike a hard disk drive, which provides direct access storage. A disk drive can move to any position on the disk in a few milliseconds, but a tape drive must physically wind tape between reels to read any one particular piece of data.
Explanation:
Architecturally tape drives are sequential storage, meaning that if you need to access some data at the end of the tape you needed to seek to the end and retrieve it. This can take seconds or minutes. Disks, OTOH are random access. Some hard drives use rotating media and movable heads , so the seek times are instantaneous , at least compared with tape drives. However, like tapes, there is a big advantage to using a rotating hard drive as sequential storage. It takes time, measured in milliseconds, for a head to move to another track. So traditionally, random access is much slower than sequential access.
SSDs have no internal moving parts so random access occurs in the same time frame as sequential access. Moreover, these drives usually have very high performance. For example, they can saturate a SATA data link, meaning that the SATA connection to the motherboard is now a bottleneck in disk access.
At one time tape drives were very popular. They were a low-cost alternative to using disks as backup. They were especially useful when IBM invented the Winchester “fixed” drive. This meant that the hard drive is fixed within its enclosure like they are today. Prior to this one could remove the drive pack and replace it. This was helpful when upgrading to a new version of the operating system as it was simple to replace the older drive pack should there be a problem.
Tape drives can be used in larger data centers, due to the fact that tape volumes can be removed and replaced so that the actual tape drive can backup many disk sets. Also the tape volumes can be stored off-site or in a fire-proof vault so this is valuable in a data recovery scenario.