On Python perform the following operations on numbersList = [-11, -4, 5, 12, 13, 14, 19]
a) Ask the user for an index number. Check to see if the index is in the range. If it is, pop the element from that index. Print the popped element as well as the list. If the index is out of range notify the user.
b) Improve your code by using a loop. Keep asking the user for an index until they enter an index which is in the range.
c) Improve your code further by adding an outer loop. Ask the user if they want to continue removing elements from the list. When the user is done removing elements from the list, convert the final list to a tuple and print it out.
In: Computer Science
Write the formula for Cardiac Output. Explain the components and give an example
In: Nursing
1. Summarize the basic facts about how HIV infection progresses to AIDS, list the risk factors for HIV infection, and list strategies for reducing the risk of HIV infection.
2. Summarize the basic facts about cardiovascular diseases, list the controllable and uncontrollable risk factors, and describe how to reduce the risk of cardiovascular disease development.
3. Describe the two basic types of diabetes, management methods, and ways to reduce the risk of developing diabetes
4. Identify the basic risk factors and warning signs of cancer, describe the basic treatment methods, and list strategies for reducing cancer risk.
5. Describe the symptoms and management of several chronic health conditions.
In: Nursing
Please answer this multi-part question. Thank you!
For this assignment you must write the following function in Scheme:
4 Write a recursive function called mergesort
that sorts a list by doing the following:
(a) Use split to split the list into two roughly equal-sized
partitions.
(b) Recursively sort both partitions.
(c) Use merge to merge the sorted partitions together.
Once again you will need two base cases, one for the empty list and
the other for a single-element list.
> (mergesort '())
()
> (mergesort '(9))
(9)
> (mergesort '(8 6 7 5 3 0 9))
(0 3 5 6 7 8 9)
In: Computer Science
Please answer this multi-part question. Thank you!
For this assignment you must write the following functions in Scheme:
4 Write a recursive function called mergesort
that sorts a list by doing the following:
(a) Use split to split the list into two roughly equal-sized
partitions.
(b) Recursively sort both partitions.
(c) Use merge to merge the sorted partitions together.
Once again you will need two base cases, one for the empty list and
the other for a single-element list.
> (mergesort '())
()
> (mergesort '(9))
(9)
> (mergesort '(8 6 7 5 3 0 9))
(0 3 5 6 7 8 9)
In: Computer Science
In: Anatomy and Physiology
Describe fraud.
What are the three categories of fraud and list an example of each.
Describe the fraud triangle.
List the key requirements of the Sarbanes-Oxley Act (SOX)
List the components of the framework commonly used in corporations when analyzing their internal control systems:
List the five common principles of Internal Control and give an explanation and example of each
Name two reasons why internal control for cash is important.
What does the term “cleared the bank” mean?
What are the two basic reasons that a company’s cash records do not balance to the bank statement?
10) Define the following:
Bank errors
EFT
Service charges
NSF checks
Deposits in transit
In: Accounting
.data
A: .space 80 # create integer array with 20 elements ( A[20] )
size_prompt: .asciiz "Enter array size [between 1 and 20]: "
array_prompt: .asciiz "A["
sorted_array_prompt: .asciiz "Sorted A["
close_bracket: .asciiz "] = "
search_prompt: .asciiz "Enter search value: "
not_found: .asciiz " not in sorted A"
newline: .asciiz "\n"
.text
main:
# ----------------------------------------------------------------------------------
# Do not modify
la $s0, A # store address of array A in $s0
add $s1, $0, $0 # create variable "size" ($s1) and set to 0
add $s2, $0, $0 # create search variable "v" ($s2) and set to 0
add $t0, $0, $0 # create variable "i" ($t0) and set to 0
addi $v0, $0, 4 # system call (4) to print string
la $a0, size_prompt # put string memory address in register $a0
syscall # print string
addi $v0, $0, 5 # system call (5) to get integer from user and store in register $v0
syscall # get user input for variable "size"
add $s1, $0, $v0 # copy to register $s1, b/c we'll reuse $v0
prompt_loop:
# ----------------------------------------------------------------------------------
slt $t1, $t0, $s1 # if( i < size ) $t1 = 1 (true), else $t1 = 0 (false)
beq $t1, $0, end_prompt_loop
sll $t2, $t0, 2 # multiply i * 4 (4-byte word offset)
addi $v0, $0, 4 # print "A["
la $a0, array_prompt
syscall
addi $v0, $0, 1 # print value of i (in base-10)
add $a0, $0, $t0
syscall
addi $v0, $0, 4 # print "] = "
la $a0, close_bracket
syscall
addi $v0, $0, 5 # get input from user and store in $v0
syscall
add $t3, $s0, $t2 # A[i] = address of A + ( i * 4 )
sw $v0, 0($t3) # A[i] = $v0
addi $t0, $t0, 1 # i = i + 1
j prompt_loop # jump to beginning of loop
# ----------------------------------------------------------------------------------
end_prompt_loop:
addi $v0, $0, 4 # print "Enter search value: "
la $a0, search_prompt
syscall
addi $v0, $0, 5 # system call (5) to get integer from user and store in register $v0
syscall # get user input for variable "v"
add $s2, $0, $v0 # copy to register $s2, b/c we'll reuse $v0
# ----------------------------------------------------------------------------------
# TODO: PART 1
# Translate C code into MIPS (bubble sort)
# The above code has already created array A and A[0] to A[size-1] have been
# entered by the user. After the bubble sort has been completed, the values im
# A are sorted in increasing order, i.e. A[0] holds the smallest value and
# A[size -1] holds the largest value.
#
# int t = 0;
#
# for ( int i=0; i<size-1; i++ ) {
# for ( int j=0; j<size-1-i; j++ ) {
# if ( A[j] > A[j+1] ) {
# t = A[j+1];
# A[j+1] = A[j];
# A[j] = t;
# }
# }
# }
#
# ----------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------
# TODO: PART 2
# Translate C code into MIPS (binary search)
# The array A has already been sorted by your code above int PART 1, where A[0]
# holds the smallest value and A[size -1] holds the largest value, and v holds
# the search value entered by the user
#
# int left = 0;
# int right = size - 1;
# int middle = 0;
# int element_index = -1;
#
# while ( left <= right ) {
#
# middle = left + (right - left) / 2;
#
# if ( A[middle] == v) {
# element_index = middle;
# break;
# }
#
# if ( A[middle] < v )
# left = middle + 1;
# else
# right = middle - 1;
#
# }
#
# if ( element_index < 0 )
# printf( "%d not in sorted A\n", v );
# else
# printf( "Sorted A[%d] = %d\n", element_index, v );
#
# ----------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------
# Do not modify the exit
# ----------------------------------------------------------------------------------
exit:
addi $v0, $0, 10 # system call (10) exits the progra
syscall # exit the program
In: Computer Science
can someone fix the infinite loop, it's stupid question, I don't know why for add field I get an infinite loop, but not for anything else
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int n, n2;
int n3;
int id; int m;
char keno[50]; int x;
struct entity
{
string random_words{};
string title{};
char keno[50]{};
int y_tho{};
int random_numbers{};
int ID{};
int id{};
int I_hate_this{};
int x{};
int m{};
};
int main()
{
cout << "Generic database creation
program.";
//vector to store employee data
vector< struct entity* > v;
entity e;
//loop to take continuous data from user
while (1)
{
cout << "What would you like
to do next?\n" << "1. Add entity\n" << "2. Edit
entity\n" << "3. Remove entity\n" << "4. Print entity
info\n" << "5. Stop the program\n" << ">> ";
cin >> n;
int ID, id, pos;
struct entity* entity = new struct
entity();
switch (n)
{
case 1:
//Please start
with 0 in console, I don't know how to automatically assign
them
cin >>
entity->ID;
cout <<
"The new entity with ID " << entity->ID << " has
been added to the database.\n";
v.push_back(entity); //Learned to use v.push_back from discord
chat, not my own idea
break;
case 2:
cout <<
"Please enter ID of the entity to edit: ";
cin >>
ID;
cout << "Editing entity (ID " << ID << " )... ";
pos =
-1;
for (size_t i =
0; i < v.size(); i++)
{
if (v[i]->ID == ID)
{
pos = i;
}
}
while (1)
{
cout << "What would you like to do
next\n";
cout << "1. Add field\n";
cout << "2. Edit field\n";
cout << "3. Remove field\n";
cout <<
"4. Go back to main menu\n";
cin >>
m;
switch (m)
{
while (1)
{
case 1:
cout << "Adding field
to entity ( ID " << ID << ") named: >>";
cin.get(e.keno, 50);
cout << "Select type :
0 - characters, 1 - integer, 2 - float, 3 - boolean: >>"
;
if (x == 0)
{
getline(cin, entity->random_words);
v.push_back(entity);
}
else if (x == 1)
{
cin
>> entity->y_tho;
v.push_back(entity);
}
else if (x == 2)
{
cin
>> entity->random_numbers;
v.push_back(entity);
}
else
{
getline(cin, entity->random_words);
v.push_back(entity);
}
break;
case 2:
cout << "Please enter
ID of the field to edit: ";
cin >> ID;
cout << "Editing entity (ID " << ID << " )... ";
pos = -1;
for (size_t i = 0; i <
v.size(); i++)
{
if (v[i]->ID == ID)
{
pos = i;
}
}
break;
case 3:
cout << " Please
provide field ID you want to remove: >> ";
cin >> ID;
pos = -1;
for (size_t i = 0; i <
v.size(); i++)
{
if
(v[i]->ID == ID)
{
pos = i;
}
}
v.erase(v.begin() +
ID);
break;
case 4: {
break;
}
}
break;
}
}
v.push_back(entity); //Learned to use v.push_back from discord
chat, not my own idea
break;
case 3:
cout <<
" Please provide entity ID: >> ";
cin >>
ID;
pos = -1;
for (size_t i =
0; i < v.size(); i++) {
if (v[i]->ID == ID) {
pos = i;
}
}
v.erase(v.begin() + ID);
break;
case 4:
cout <<
" Please provide entity ID: >> ";
cin >>
ID;
//search for
that employee in our database
pos = -1;
for (size_t i =
0; i < v.size(); i++) {
if (v[i]->ID == ID) {
ID = i;
}
}
cout <<
"Entity ID " << ID << " has" << ID << "
fields";
cout <<
"[Field " << ID << v[ID]->title;
break;
case 5:
return 0;
}
}
}
use c++
In: Computer Science
Data set for ages of students in stats class:
17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,19, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 25, 25, 25, 26, 26, 27, 28, 28, 28, 28, 29, 29, 32, 36, 42
1) Find the standard deviation of the ages and use it to calculate a 95% confidence interval for the true mean age (be sure to use the correct degrees of freedom). Do the median and the mode fall into this range?
2) Someone once told me that the average age of PSU students is 26. Does this value fall within the confidence interval? If 26 is the true mean and σ=5, what is the probability that we would observe a sample mean in our sample (n=49) that is less than 24? Given these answers, would you agree that 26 is the true mean?
3) Find the proportion of students who can legally drink alcohol in the State of Oregon (students who are 21 or over). Use this to find a 90% confidence interval for the true proportion of PSU students that can drink. If we wanted the margin of error to be less than .05, what is the minimum sample size that we would need?
4) Assume that student ages are normally distributed and that the mean and standard deviation of the sample are the true population values. Under this assumption, what would be the probability of that someone would be able to drink, to wit, find P(X>21)? Does this value fall within the confidence interval you found in problem 4?
5) Compute the 5-number summary and create a modified box-plot, using the inner-quartile range to identify any outliers.
6) Construct a histogram of the data (starting at 16.5, use a class width of 3). Is the data skewed? If so, is it skewed right or left? What factors in the population (such as a natural boundary) may be causing this? How does this affect problems 2 and 4?
7) Suppose we are trying to use this sample to infer something about the ages of all PSU students. Explain why this is not a truly random
sample and how it may be biased compared to the PSU student population at large. How does this affect problem 2?
8) Find a 95% confidence interval for the true standard deviation of ages.
In: Statistics and Probability