subject

Question 1a 1. Create a (3,3) array where row 0 is [0, 0, 0], row 1 is [2, 2, 2], row 2 is [-2, -2, -2]. Print the array.
2. Change element [0,0] to 10 and element [2,2] to -10. Print the array.
3. Subtract 2 from every element. Print the array.
4. Print all of the elements of the revised array that are positive.
In [ ]: # Your codes for 1.
In [ ]: # Your codes for 2.
In [ ]: # Your codes for 3.
In [ ]: # Your codes for 4.
Question 1b
You are provided with two lists of numbers.
• List 'x' denotes all 8 possible dollar investment outcomes of a risky project;
• List 'p' denotes their corresponding outcome probabilities.
• For instance, there is a 5% chance of $10000.
In this question, let's first convert the two lists into two separate arrays. Can you use np. dot to calculate the expected value of this risky project? That is, 10000X0.05+1000X0.05+100X0.2 ... Calculation without using np. dot() will be considered no points.
Finally, print the following sentence using print+format: The expected value of this risky project is $XXX. X.
Hint: the portfolio mean return example at the end of 2.3
In [ ]: x = (10000, 1000, 100, 10, 1, 0, -10, -100]
p = [0.05, 0.05, 0.20, 0.20, 0.1, 0.1, 0.1, 0.2]
In [ ]: # Your code here

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 13:00
George heard about the benefits of a data warehouse. he wants to try implementing one for his organization. however, he is afraid that transferring data to the data warehouse will affect transaction time. which element ensures that transactions are not affected when moving data to a warehouse? when data is transferred to a data warehouse, the a area frees the source system to continue transaction processing.
Answers: 2
question
Computers and Technology, 24.06.2019 13:30
Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. the program should output the average high, average low, and the highest and lowest temper- atures for the year. your program must consist of the following functions: a. function getdata: this function reads and stores data in the two- dimensional array. b. function averagehigh: this function calculates and returns the average high temperature for the year. c. function averagelow: this function calculates and returns the aver- age low temperature for the year. d. function indexhightemp: this function returns the index of the highest high temperature in the array. e. function indexlowtemp: this function retur
Answers: 3
question
Computers and Technology, 24.06.2019 18:20
Acommon algorithm for converting a decimal number to binary is to repeatedly divide the decimal number by 2 and save the remainder. this division is continued until the result is zero. then, each of the remainders that have been saved are used to construct the binary number.write a recursive java method that implements this algorithm.it will accept a value of int and return a string with the appropriate binary character representation of the decimal number.my code: public class lab16{public string converttobinary(int input){int a; if(input > 0){a = input % 2; return (converttobinary(input / 2) + "" +a); } return ""; } }
Answers: 1
question
Computers and Technology, 24.06.2019 18:30
What is the local portion of the e-mail address below? [email protected] a.) @ b.) biz c.) gumchewer d.) twrigley
Answers: 1
You know the right answer?
Question 1a 1. Create a (3,3) array where row 0 is [0, 0, 0], row 1 is [2, 2, 2], row 2 is [-2, -2...
Questions
question
Mathematics, 17.09.2019 03:10
question
Social Studies, 17.09.2019 03:10
Questions on the website: 13722367