Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

im stuck with writing a working code for those in python: Using python, how do I write a function called countCodons(DNA) which takes an input

im stuck with writing a working code for those in python:

  1. Using python, how do I write a function called countCodons(DNA) which takes an input a DNA string (you may assume its length is a multiple of 3) and returns the number of codons in that string. For example, countCodons("CATGGG") returns 2.

I started with def countCodon(DNA): DNA=

  1. Using python, how do you make a palindrome is a string that is the same forwards as backwards. For example "radar", "wow", and "abba" are all palindromes. Write a function called palindrome4(input) that takes a string of length exactly 4 as input and returns the Boolean True if that string is a palindrome and returns the Boolean False otherwise. If the string has length less than or greater than 4, the function should also return False. Here's an example of the function in action:

  1. A DNA string is called an open reading frame (ORF) if it begins with 'ATG', ends with 'TGA', 'TAG', or 'TAA', and has a length that is a multiple of ORFs are interesting because they can encode proteins. Write a function called ORFadviser(DNA) that takes a string called DNA as input and works as follows: you can start with def ORFadviser(DNA):

The function returns the string 'This is an ORF' if the input string satisfies all three of the conditions required of ORFs.Otherwise, if the first three symbols are not 'ATG', the function returns the string 'The first three bases are not ATG'. Otherwise, if the string does not end with 'TGA', 'TAG', or 'TAA', the function returns the string 'The last three bases are not a stop codon'.

Otherwise, the function returns the string 'The string is not of the correct length.'

  1. Write a function called friendly(greeting) that takes a string named greeting as input. If the greeting begins with the words 'Hello' or 'Hi', the function returns some friendly greeting string of your choice. Otherwise, if the greeting string ends with a question mark, the function returns the string 'Good question!'. Otherwise, the function returns with some string indicating that it didn't understand the greeting (e.g., 'I am sorry, but I did not understand you.').
  2. Lastly, how do you write a simpler code in python to calculate gcContent of any length of DNA string using for LOOP. You can call your function gcContent(DNA).
  • Here are some examples of gcContent(DNA) that work:

>>> gcContent("ACCGC")

0.8

>>> gcContent("ATACTAAA")

0.125

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions