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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 21:30, Nathaliasmiles
The graph shows median weekly earnings for full-time workers according to education level. which can you not conclude?
Answers: 2
image
Computers and Technology, 23.06.2019 09:00, paulusl19
The first screen you see when you open word2016 what is called?
Answers: 1
image
Computers and Technology, 23.06.2019 16:30, rileysndr1782
Monica and her team have implemented is successfully in an organization. what factor leads to successful is implementation? good between different departments in an organization leads to successful is implementation.
Answers: 1
image
Computers and Technology, 23.06.2019 18:00, teamroper35
Which finger presses the h key on the keyboard? index finger on the left hand pinky finger on the right hand index finger on the right hand thumb on the left hand
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 in other subjects:

Konu
Biology, 29.10.2020 18:40