Answer:
Here is the Python program:
#the method acronym that takes an argument phrase
def acronym(phrases):
acronym = "" #to store acronym of a phrase
#loop to split the input phrase and return its acronym in upper case letters
for phrase in phrases.split():
acronym = acronym + phrase[0].upper()
return acronym
#main function that takes input phrase from user and display its acronym
def main():
phrases = input("Enter a phrase: ")
print("The acronym for your phrase is ",acronym(phrases))
main()
Explanation:
First let me explain the method acronym. This method takes a parameter phrase to return its corresponding acronym. First the phrase is split using split() method which is used to return the list of words in a phrase. For loop is used that will keep splitting the words in the string (phrase) entered by the user.
In this statement: acronym = acronym + phrase[0].upper() the acronym is computed. phrase[0] means the first character of each word in the phrase which is found out by the split() method is converted to upper case by using upper() function and then stored in acronym variable. Each time the acronym is found and its first character is converted to upper case and added to the acronym variable.
Then the main() function prompts the user to enter a phrase and then calls the acronym function and passed that phrase as parameter to that function. Then the computed acronym for the phrase is printed on the screen.
Answer:
Explanation:
The following code is written in Python. It continues looping and asking the user for an oligonucleotide sequence and as long as it is valid it outputs the reverse complement of the sequence. Otherwise it exits the loop
letters = {'A', 'C', 'G', 'T'}
reloop = True
while reloop:
sequence = input("Enter oligonucleotide sequence: ")
for x in sequence:
if x not in letters:
reloop = False;
break
if reloop == False:
break
newSequence = ""
for x in sequence:
if x == 'A':
newSequence += 'T'
elif x == 'T':
newSequence += 'A'
elif x == 'C':
newSequence += 'G'
elif x == 'G':
newSequence += 'C'
print("Reverse Complement: " + newSequence)
Answer:
The answer to this question is given below in the explanation section.
Explanation:
This question is about to tell the best and suitable terms for the given descriptions in the question.
As we know that a computer program is based on sets of instructions. The CPU carries out the processing using the fetch decode and execute cycle.
It is responsible for implementing a sequence of instructions called a computer program that takes input, processes them, and outputs the result based on processing.
A CPU mainly has three components such as control unit, Arithmetic logic unit, and register.
The control unit controls all parts of the computer system. It manages the four basic operations of the Fetch Execute Cycle such as Fetch, Decode, Executes, and Storage.
So the correct terms of this question are:
Fetch: Gets next instruction
Decode: interprets the instruction
Execute: Carries out instruction.
Store: Save results of instruction.