There are some typos in this question as the numbers become too large and lead to undefined during calculations.
so the correct data is:
Songs = 12
Rock = 15
Blues = 20
Disco = 15
The answer & explanation for this question is given in the attachment below.
Answer:
Explanation:
The following code is written in Python and does exactly as requested. It is a function named replace_one(t, d) that takes the two parameters one text/word and one dictionary. If the word is found as a key in the dictionary it places the value in a variable called new_word and returns it to the user, if it is not found then the function returns nothing.
def replace_once(t, d):
if t in d:
new_word = d.get(t)
return new_word
return
Answer:
def extract_title(file):
import re
a =''
with open(file,'r') as file:
for line in file:
a += line
m = re.search("^(TITLE)(.*?)(JOURNAL)", a, re.M + re.S)
print(m.groups()[1])
extract_title('new.txt')
Explanation:
The programming language used is python 3.
The function is first defined and the regular expression module is imported.
A variable is initialized to an empty string that will hold the content of the GenBank formatted file.
The file is opened and every line in the file is assigned to the string variable. The WITH statement allows files to be closed automatically.
Regular expression is used to capture all the files between TITLE and JOURNAL in a group.
The group is printed and the function is called.
I have attached a picture of the code in action.
All answers are correct.
Source and explanation: certificationanswers.com/en/category/hootsuite-platform/
```
#!/usr/local/bin/python3
import sys
def print_factorial( user_val ):
if( user_val < 1 ):
return( 1 )
else:
return( print_factorial( user_val - 1 ) * user_val )
if( __name__ == "__main__" ):
if( len( sys.argv ) == 2 ):
print( print_factorial( int ( sys.argv[ 1 ] ) ) )
else:
sys.stderr.write( "usage: %s <integer>\n" % sys.argv[ 0 ] )
exit( 0 )
```