Question: # 1 ) Write a function that checks whether a given word or number is palindrome or not # and returns True if it is
# Write a function that checks whether a given word or number is palindrome or not
# and returns True if it is palindrome and False if it is not palindrome.
def ispalindromeword:
pass # remove this line and comment and replace it with the code needed for the main function.
# write a function that computes the length of a DNA sequence and the proportion of individual bases in the sequences
# Note that: the function must return the four values inorder of DNAsequencelength, baseAproportion,
# baseTproportion, baseCproportion and baseGproportion.
def dnanucleotidetext:
pass # remove this line and comment and replace it with the code needed for the main function.
def main:
word input Please enter a word :
# uncomment the following lines to test your ispalindrome function
# if ispalindromeword:
# printfword is palindrome!"
# else:
# printfword is not palindrome!"
print
txt input Please enter a DNA sequence:
# uncomment the following lines to test your dnanucleotide function
# dnalength, baseAprop, baseTprop, baseCprop, baseGprop dnanucleotidetxt
# printf DNA sequence length dnalength
# printf Base A proportion baseAprop:f
# printf Base T proportion baseTprop:f
# printf Base C proportion baseCprop:f
# printf Base G proportion baseGprop:f
if namemain:
main using Assignment Requirements
For this assignment, you need to commplete the following two problems as described below and based on the starter code
Problem : A palindrome is a word or number that reads the same backward or forward.
Example:
palindrome number:
palindrome word: racecar, civic, madam,
Write a python function to check if a given string is palindrome or not. Your function is name ispalindrome word The function returns true if the given word is palindrome false otherwise.
Problem : Given a DNA nucleotide seqences, for instance:
DNA"ATGCGCGGATCGTACCTAATCGATGGCATTAGCCGAGCCCGATTACGC"
Write a python program that computes the length of the sequence and the proportion of individual bases in the sequence. That is percentage of AA percentage of T T percentage of C C and percentage of G G
The function name is dnanucleotide text and it returns five values such as dnalength, baseAproportion, baseTproportion, baseCproportion and baseGproportion respectively. The text can be given in lower case or uppercase. Your code must work in both cases. Thus, consider converting the given text to upper case. There are only four bases ATC and G in DNA sequence.
Note that:
baseAproportionpercentage of A number of letter A in the texttotal length of the text
Similarly, you can compute for percentage of T percentage of C and percentage of G
this was my written code and there are still test fails can you please fix it
# Write a function that checks whether a given word or number is palindrome or not
# and returns True if it is palindrome and False if it is not palindrome.
def ispalindromeword:
word word.lower
return word word::
# write a function that computes the length of a DNA sequence and the proportion of individual bases in the sequences
# Note that: the function must return the four values inorder of DNAsequencelength, baseAproportion,
# baseTproportion, baseCproportion and baseGproportion.
def dnanucleotidetext:
text text.upper
dnalength lengtext
countA text.countA
countT text.countT
countC text.countC
countG text.countG
if dnalength :
return dnalength,
propA countA dnalength
propT countT dnalength
propC countC dnalength
propG countG dnalength
return dnalength, propA propT propC propG
def main:
word input Please enter a word :
if ispalindromeword:
printf
word is palindrome!"
else:
printf
word is not palindrome!"
txt input
Please enter a DNA sequence:
dnalength, baseAprop, baseTprop, baseCprop
printf
DNA sequence length dnalength
printfBase A proportion baseAprop:f
printfBase T proportion baseTprop:f
printfBase C proportion baseCprop:f
printfBase G proportion baseGprop:f
if namemain:
main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
