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, 22.06.2019 06:00
Write a program that uses a widgetviewer object to do the following: generate two random integers between 1 and 9 (inclusive). name one of them x, the other y. display them to the user using jlabel objects. create a jlabel object displaying the text "enter an operation number." create a jtextfield for the user's input. create a jbutton displaying the text "press here when you've entered your operation." use addandwait to add it to the widgetviewer object. when the user clicks the jbutton, evaluate operation in the following order to determine the one and only mathematical operation to perform on x and y. use a jlabel to display the result. if operation is between 1 and 10 inclusive, add x and y. if operation is evenly divisible by 4, subtract y from x. if operation is evenly divisible by 5, use integer division to divide y into x. if operation is an even number, use floating point division to divide y into x. if none of the other tests on operation apply, multiply x and y. note: operation can be negative or zero.
Answers: 2
question
Computers and Technology, 23.06.2019 23:00
How do you know if the website is secure if you make a purchase
Answers: 2
question
Computers and Technology, 24.06.2019 02:30
Assume a class window with accessor method getwidth that accepts no parameters and returns an integer. assume further an array of 3 window elements named winarr, has been declared and initialized. write a sequence of statements that prints out the width of the widest window in the array.
Answers: 2
question
Computers and Technology, 24.06.2019 05:30
Why is hard disk space important to an audio engineer? why are usb ports and firewire ports useful for an audio engineer? explain in 2-3 sentences. (3.0 points) here's a list of different audio software: ableton live apple inc.'s garageband apple inc.'s logic studio digidesign's pro tools propellerhead sofware's reason sony creative software's acid pro steinberg cubase steinberg nuendo choose one of the software programs listed above, and then go to that software program's web site. read about what the software program is used for, and then write 4-5 sentences about what you learned. (10.0 points) which type of software license is the most limiting? why? explain in 2-3 sentences. (3.0 points) when sending a midi channel voice message, how can you control the volume of the sound? explain in 2-3 sentences. (4.0 points)
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, 27.09.2021 21:40
question
Mathematics, 27.09.2021 21:40
question
Business, 27.09.2021 21:40