Homework:
You are to locate the file ```src/mutDetect_todo_i.py``` in which you are to fix twelve bugs to run the program. Your output should look _exactly_ like that featured in the assignment lab. Please read the assignment sheet for other details about the lab.
#mutDetect_todo_i.py
############################################################################
# TODO: There are twelve EMBARRISING silly bugs to fix. Can you
find them?!
############################################################################
DATE = "16 Sept 2019"
VERSION = "i"
AUTHOR = " myName"
AUTHORMAIL = "@allegheny.edu"
def help():
h_str = " "+DATE+" | version: "+VERSION+" |"+AUTHOR+" |
"+AUTHORMAIL
print(" "+len(h_str) * "-")
print(h_str)
print(" "+len(h_str) * "-")
print("\n\tThe blank-blank program to do something cool.")
#print("""\n\tLibrary installation notes:""")
print("\t+ \U0001f600 USAGE: python3 mutDetect.py <any key to
launch>")
######################################################
#end of help()
def getSeq():
""" Function to get a sequence (a string) from the user"""
print(" __Getting a sequence__")
prmpt = "\tEnter a sequence :"
seq_str = int(input(prmpt))
return seq_str.lower()
######################################################
# end of getSeq()
def compareSequences(seq1_str, seq2_str):
""" Compares the sequences base by base"""
print("\n __Comparing sequences__")
for i in range(len(seq1_str)):
# check to see whether the bases are the same going through the
sequences
try:
if seq1_str[i] == seq2_str[i]: # are bases _not_ the same at the
same position?
print("\t + Bases not the same at pos: ",i)
print("\t\t First seq char : " seq1_str[i])
print("\t\t Second seq char : ", seq2_str[i])
except IndexError:
#print(" \t Sequences are uneven length!")
pass
# end of compareSequences()
def getSeqLength(seq_str):
""" Function to return the length of a sequence"""
l_int = len(seq_str)
if l_int % 2 = 0: # can we read triplets, groups of three?
print("\t Warning! Sequence length cannot be divided into groups of
triplets!")
return l_int
######################################################
#end of getSeqLength()
def compareSeqLength(seq1_str, seq2_str):
"""Function to check the lengths of the sequences to make sure that
they are the same length. This is necessary for making
comparisons."""
if len(seq1_str) = len(seq2_str):
return True
else:
return True
######################################################
#end of compareSeqLength()
def translate(dna_str):
""" Function to translate the DNA. Create a protein sequence from
the DNA."""
sequence = Seq(dna_str)
#make some variables to hold strings of the translated code
# give me RNA from the DNA
RNAfromDNA_str = Seq.transcribe(sequence) #transcription step:
converting dna to rna
# give me DNA from the RNA
DNAfromRNA_str = Seq.back_transcribe(sequence)
# give me the protein from the dna
PROTfromRNA_str = Seq.translate(RNAfromDNA_str)
# print the output of the string variables
print("\n __Translation__")
print("\t + Original DNA :", dna_str ", length is :",
len(dna_str))
# print("\t + RNA from DNA :", RNAfromDNA_str)
# print("\t + DNA from RNA :", DNAfromRNA_str)
print("\t + PROTEIN from RNA :",PROTfromRNA_str)
return PROTfromRNA_str
######################################################
#end of translate()
def begin(task_str):
"""Driver function of program"""
print("\n\t Welcome to mutDetect!\n\t A program to compare DNA,
make protein and compare protein sequences.)
# get first DNA sequence
seq1_str = getSeq()
# get second DNA sequence
seq2_str = getSeq()
print("\t + Length of first sequence :",
getSeqLength(seq2_str))
print("\t + Length of second sequence :",
getSeqLength(seq2_str))
# compare the sequences
compareSeQuences(seq1_str, seq2_str)
print("\t + Sequences are same length: ",compareSeqLength(seq1_str,
seq2_str))
prot1_seq = Translate(seq1_str)
#print(type(prot1_seq))
protein1_str = str(prot1_seq)
print("\t + protein1 sequence :",protein1_str)
prot2_seq = translate(seq2_tsr)
#print(type(prot2_seq))
protein2_str = str(prot2_seq)
print("\t + protein2 sequence :",protein2_str)
compareSequences(protein1_str, protein2_str)
######################################################
#end of begin()
import os, sys
#import math
# list other libraries below
# load my biopython library
from Bio.Seq import Seq
if __name__ == '__main__':
if len(sys.argv) == 2: # one parameter at command line
# note: the number of command line parameters is n + 1
begin(sys.argv[1])
else:
help() # If no command-line parameter entered, then run the help()
function
sys.exit()
In: Computer Science
Q1: In the addition of floating-point numbers, how do we adjust the representation of numbers with different exponents?
Q2:
Answer the following questions:
In: Computer Science
Potassium dichromate is used in breathalyzers to measure alcohol content. The balanced chemical equation for the reaction between ethanol and potassium dichromate is given below.
3CH3CH2OH (aq) + 2K2Cr2O7 (aq) + 8H2SO4 (aq) --> 3CH3COOH (aq) + 2Cr2(SO4)3 (aq) + 2K2SO4 (aq) + 11H2O (l)
a. what is the oxidation state of Cr is Kr2Cr2O7?
b. what is the oxidation state of Cr in Cr2(SO4)3
c. Is Cr oxidized or reduced in the reaction? Explain.
In: Chemistry
Discuss different service-based server operating systems, server computers, and server software that a network administrator must choose between. Applied Concepts (AC) - Week/Course Learning Outcomes Using your textbook, LIRN-based research, and the Internet, apply the learning outcomes for the week/course and lecture concepts to one of the following scenarios: As applied to your current professional career As applied to enhancing, improving, or advancing your current professional career As applied to a management, leadership, or any decision-making position As applied to a current or future entrepreneurial endeavor OR Using your textbook, LIRN-based research, and the Internet, apply the learning outcomes for the week/course and lecture concepts to a business organization that exhibits and demonstrates these concepts. You should develop a summary of the organization's strategy and how they use these concepts to compete. This is a learning and application exercise designed to give you an opportunity to apply concepts learned in a pragmatic and meaningful way that will enable you to gain valuable and relevant knowledge in an effort to augment your skill set and enhance your professional careers.
In: Computer Science
Please Write-In Python Language (Topic: Word frequencies)
Method/Function: List<Token>
tokenize(TextFilePath)
Write a method/function that reads in a text file and returns a
list of the tokens in that file. For the purposes of this project,
a token is a sequence of alphanumeric characters, independent of
capitalization (so Apple, apple, aPpLe are the
same token). You are allowed to use regular expressions if you wish
to (and you can use some regexp engine, no need to write it from
scratch), but you are not allowed to import a tokenizer (e.g. from
NLTK), since you are being asked to write a tokenizer.
Method: Map<Token,Count>
computeWordFrequencies(List<Token>)
Write another method/function that counts the number of occurrences
of each token in the token list. Remember that you should write
this assignment yourself from scratch so you are not allowed to
import a counter when the assignment asks you to write that
method.
Method: void print(Frequencies<Token,
Count>)
Finally, write a method that prints out the word frequency count
onto the screen. The print out should be ordered by decreasing
frequency (so, the highest frequency words first).
Print the output in this format:
<token> -> <freq>
Please give me some notes about the codes, thanks!!!
In: Computer Science
Java program - you are not allowed to use arithmetic operations such as division (/), multiplication, or modulo (%) to extract the bits. In this exercise use only logic bit-wise operations. Write a program that prompts the user to enter a positive integer n (0 up to 232 -1). You must write a function that takes as input n and returns a string s representing the number n in binary. For this assignment, you CANNOT use the arithmetic division by 2 or the modulo operation to convert the number to binary. Your main program must print out s. Example: If the user enters the number 66, your program must print out 1000010. Hints for Programming Exercise 3: Hint 1: The number n is already in binary inside the memory. All you need is to “extract” or “read” the bits CPSC 3303 Programming Project 1 individually. Read the next hints to know how. Hint 2: Consider the number n=66. In the memory, 66 is 0000000001000010. I can isolate the least significant bit (red rightmost bit) by using the logic operation AND (&). Compute n & 1 = 66 & 1. Try the operation x & 1 with x taking different values to find out the effect: the operation “& 1” returns the value of the least significant bit! Hint 3: Say, for example, you read the rightmost bit with the operation “ & 1”. How should you read the bit that is to the left of the least significant bit (i.e., the blue bit to the left of the red bit)? The hint is to push all the bits to the right after I extracted the rightmost bit. To push to the right, you can shift right (>>) the number n to the right. n >> 1 = 66 >> 1 = 0000000000100001: all bits are pushed to the right. Now, that bit became the rightmost bit. . . And you know how to read the rightmost bit.
import java.util.Scanner;
public class DecimalToBinary
{
public static void main(String[]args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Enter a positive integer: ");
int n = scan.nextInt();
for (int i = 31; i >= 0; i--)
{
if ( ((1 << i) & n) != 0)
System.out.print(1);
else
System.out.print(0);
}
}
}
****This is what I have written so far, but the output below has way too many leading zeros. What do I need to do to fix this? ****
Enter a positive integer:
66
00000000000000000000000001000010
In: Computer Science
Assume that females have pulse rates that are normally distributed with a mean of mu equals 73.0 beats per minute and a standard deviation of sigma equals 12.5 beats per minute. Complete parts (a) through (c) below. a. If 1 adult female is randomly selected, find the probability that her pulse rate is less than 79 beats per minute. The probability is ____. (Round to four decimal places as needed.) b. If 4 adult females are randomly selected, find the probability that they have pulse rates with a mean less than 79 beats per minute. The probability is _____. (Round to four decimal places as needed.) c. Why can the normal distribution be used in part (b), even though the sample size does not exceed 30? A. Since the original population has a normal distribution, the distribution of sample means is a normal distribution for any sample size. B. Since the distribution is of individuals, not sample means, the distribution is a normal distribution for any sample size. C. Since the mean pulse rate exceeds 30, the distribution of sample means is a normal distribution for any sample size. D. Since the distribution is of sample means, not individuals, the distribution is a normal distribution for any sample size.
In: Math
The driver of a 1450 kg car, initially traveling at 10.6 m/s, applies the brakes, bringing the car to rest in a distance of 24.0 m. Find the net work done on the car. Find the magnitude and direction of the force that does this work. (Assume this force is constant.)
A cyclist coasts up a 10.3° slope, traveling 19.0 m along the road to the top of the hill. If the cyclist's initial speed is 9.90 m/s, what is the final speed? Ignore friction and air resistance.
Find the minimum initial height h1 of the roller coaster in the figure below if the roller coaster is to complete the loop, where h2 = 24.6 m. Neglect friction.
In: Physics
QUESTION 20
If the following quotes are on September 15, 2012, what was the coupon rate for the JD.VR bonds with $1,000 face values and semiannual payments?
Company (Ticker) | Coupon | Maturity | Last Price | Last Yield | $ Vol. (000s) |
Jim Doe (JD.VR) | ? | Sep 15, 2034 | 117.02 | 6.6 | 6,360 |
(Do not include the percent sign (%).Enter rounded answer as directed, but do not use the rounded numbers in intermediate calculations. Round your answer to 2 decimal places (e.g., 32.16).)
In: Finance
Write a program named problem.c to generate addition and subtraction math problems for a 4th grader.
1. Your program will first ask user how many problems they want to do.
2. Repeat the following until you give user the number of problems that the user asks for.
a. Display the question number
b. Generate a addition or subtraction problem using two random generated two digits (0-99).
- The odd number of problems (1,3,5,…) will be addition problems.
- The even number of problems (2,4,6,…) will be subtraction problems. For subtraction problem, swap two numbers if the first number is smaller than the second number.
c. Display the problem, then ask user to answer. If the user answers correctly the first time, the user gets 10 points for the problem. If the user does not answer correctly, you print the problem again, and ask the user to try again. If the user answers correctly second time, the user gets 5 points for this problem. You then display the total points that user gets.
4. Calculate and display the percentage. a. If the percentage is above or equal 93%, display “Excellent”. b. If the percentage is above or equal 87%, display “Very good”. c. Otherwise, print “Keep working hard.”
Output shown look like:
How many problems would you like to do today?4
Ok! You will be given 4 math problems.
Good luck with them! Press enter to start.
Question 1
92 + 11 = 103
Correct! 10 points. Total points: 10
Question 2
95 - 10 = 85
Correct! 10 points. Total points: 20
Question 3
31 + 56 = 87
Correct! 10 points. Total points: 30
Question 4
32 - 29 = 2
Wrong. Please try again.
32 - 29 = 3
Correct. 5 points. Total points: 35
You got 87.50%! Very Good!
Thank you for using my math problem generator!
In: Computer Science
Introduction
This lab will focus on creating a Movie class conforming to the diagram above. From this class Movie objects can be instantiated and used in a running program. I have provided a mostly completely driver, you will need to add a few lines of code where specified.
What you need to do
Declare you instance variables at the top of the class.
Write a specifying constructor. No default constructor is required.
Write getName and setName. There are no restrictions on the setting the name.
Write getMinutes and setMinutes. When setting minutes, it is not allowed to be negative.
Write getTomatoScore and setTomatoScore. When setting tomato score, score is not allowed
to be negative or over 100.
Write isFresh. A score is considered fresh if it is 60 or above. It is rotten otherwise.
Write display. Print out the name, the total minutes, and if the movie is “Fresh” or “Rotten”.
Remember, you have method which tells you this now.
The driver is mostly complete. I placed one TODO, add a new movie of your choice to the array
that stores movies (called myCollection) in the driver.
Your output should match the output below plus the one movie you add to it. Pay attention to how objects are accessed in the driver. See your TA when your output is correct.
Output:
Here are all the movies in my collection of movies.
Movie: Batman The Dark Knight Length: 2hrs 32min.
Tomato Meter: Fresh
Movie: Avengers: Endgame Length: 3hrs 2min. Tomato Meter: Fresh
Movie: The GodFather Length: 2hrs 58min. Tomato Meter: Fresh
Movie: Suicide Squad Length: 2hrs 17min. Tomato Meter: Rotten
//The movie you add will print out here.
_______________________________________________ Here are the Fresh movies.
Batman The Dark Knight is fresh. Avengers: Endgame is
fresh.
The GodFather is fresh.
Here are the Rotten movies. Suicide Squad is rotten.
//The movie you add will print out here, it’s score will determine if fresh or not.
_______________________________________________
The movie Harry Potter and the Prisoner of Azkaban was created.
Is Harry Potter and the Prisoner of Azkaban a long movie? Yes, it is a bit long.
Can I set the minutes of Harry Potter and the Prisoner of
Azkaban to a negative number?
It did NOT work. Negative runtimes are not allowed.
Can I set tomato score of Harry Potter and the Prisoner of
Azkaban to a negative number?
It did NOT work. Negative scores are not allowed.
Can I set tomato score of Harry Potter and the Prisoner of
Azkaban to a number greater than 100?
It did NOT work. Still the best Harry Potter movie out all the
movies though.
In: Computer Science
Courage 1. List and describe three risks that I can take to improve my project or team’s performance. 2. List and describe three risks that I can take to improve my career. 3. List and describe the barriers that prevent you from taking career or team risks.
Alignment of time and talent 1. What resources can I provide to the organization that I work or hope to work? List and describe the knowledge, skills, and abilities that you can offer a current or perspective employer. 2. What types of organizations do I feel comfortable associating with and volunteering my time? List and give a brief description of at least two organizations, clubs, social causes, etc. 3. List and describe the barriers that prevent you from volunteering in organizations.
In: Operations Management
C++
Write a program that produces the truth table of the following logical operators. You aresupposed to output one table with all the operators (one column for each operator). Write theheader of the table - this is the name of the columns-. Output the result on the file prog1 output.txt. The table should contain the letters T and F, it should NOT print 1s and 0s. Show theresults on the following order:
1. negation (!)
2. disjunction (AND operator, &)
3. conjunction (OR operator, |)
4. exclusive or (or but not both, ^)
5. implication (CONDITIONAL operator, ->)
6. biconditional (<->)
In: Computer Science
In java
Modify your finished guessNumber.java program to include a random number generator to generate the guessed number (from 1 to 10). use the Random class to generate a random number between a range of integers. In your program include an if … then statement to check if the number you entered is bigger or smaller than the guessed number, and display a message. Also included is a counter to keep track on how many times the user has guessed, and display it at then end.
Below is the java code that needs to be modified:
/* Week3 in-class exercise
Name: numberGuess.java
Author: Your Name
Date:
*/
// need the Scanner class to get user input
import java.util.Scanner;
public class numberGuess {
/**
* @param args
*/
public static void main(String[] args) {
// TODO:
//
// a. declare a final int, and assign a value of 6 as the guessed
number
final int
guessed_number = 6;
// b. create a Scanner to get user input
Scanner input =
new Scanner(System.in);
// c. use a do {} while loop to prompt the user to enter an integer
between 1 and 10,
// assign the user input to an int, and compare to the guessing
number
int userInput =
0;
do{
System.out.println("Please enter an integer between 1 and
10.");
userInput = input.nextInt();
} while (userInput != guessed_number);
// d. if the number matches the guessed number,
// print out a message that the number entered is correct.
System.out.println("\nNice! You entered the correct
number.\n");
// Here is to print your name
System.out.println("Author: Your Name");
}
}
In: Computer Science
QUESTION 16
Three years ago, JKL Co. issued bonds with a 11-year maturity then and at a coupon rate of 7.9 percent. The bonds make semiannual payments. If the YTM on these bonds is 8.6 percent, what is the current bond price? (Do not include the dollar sign ($). Enter rounded answer as directed, but do not use the rounded numbers in intermediate calculations. Round your answer to 2 decimal places (e.g., 32.16).)
QUESTION 18
Bond RTY.AF has a 5 percent coupon, makes semiannual payments, currently has 18 years remaining to maturity, and is currently priced at par value. If interest rates suddenly rise by 2 percent, what is the percentage change in the price of Bond RTY.AF? Be sure to include the sign, especially if the bond price falls and the percentage change is negative. (Do not include the percent sign (%). Enter rounded answer as directed, but do not use the rounded numbers in intermediate calculations. Round your answer to 2 decimal places (e.g., 32.16).)
In: Finance