hw06
.pdf
keyboard_arrow_up
School
University of California, Berkeley *
*We aren’t endorsed by this school
Course
8
Subject
Computer Science
Date
Dec 6, 2023
Type
Pages
38
Uploaded by AdmiralAtom103517
hw06
November 30, 2023
[124]:
# Initialize Otter
import
otter
grader
=
otter
.
Notebook(
"hw06.ipynb"
)
1
Homework 6: Probability, Simulation, Estimation, and Assess-
ing Models
Please complete this notebook by filling in the cells provided. Before you begin, execute the previous
cell to load the provided tests.
Helpful Resource:
-
Python Reference
: Cheat sheet of helpful array & table methods used in
Data 8!
Recommended Readings
:
*
Randomness
*
Sampling and Empirical Distributions
*
Testing
Hypotheses
Please complete this notebook by filling in the cells provided.
Before you begin, execute the
cell below to setup the notebook by importing some helpful libraries.
Each time you
start your server, you will need to execute this cell again.
For all problems that you must write explanations and sentences for, you
must
provide your
answer in the designated space. Moreover, throughout this homework and all future ones,
please
be sure to not re-assign variables throughout the notebook!
For example, if you use
max_temperature
in your answer to one question, do not reassign it later on. Otherwise, you will
fail tests that you thought you were passing previously!
Deadline:
This assignment is
due Wednesday, 10/4 at 11:00pm PT
. Turn it in by Tuesday, 10/3 at
11:00pm PT for 5 extra credit points. Late work will not be accepted as per the
policies
page.
Note: This homework has hidden tests on it. That means even though tests may say
100% passed, it doesn’t mean your final grade will be 100%. We will be running more
tests for correctness once everyone turns in the homework.
Directly sharing answers is not okay, but discussing problems with the course staff or with other
students is encouraged. Refer to the
policies
page to learn more about how to learn cooperatively.
You should start early so that you have time to get help if you’re stuck.
Offce hours are held
Monday through Friday in
Warren Hall
101B. The offce hours schedule appears
here
.
1
1.1
1. Roulette
[125]:
# Run this cell to set up the notebook, but please don't change it.
# These lines import the Numpy and Datascience modules.
import
numpy
as
np
from
datascience
import
*
# These lines do some fancy plotting magic.
import
matplotlib
%
matplotlib
inline
import
matplotlib.pyplot
as
plt
plt
.
style
.
use(
'fivethirtyeight'
)
import
warnings
warnings
.
simplefilter(
'ignore'
,
FutureWarning
)
A Nevada roulette wheel has 38 pockets and a small ball that rests on the wheel. When the wheel
is spun, the ball comes to rest in one of the 38 pockets. That pocket is declared the winner.
The pockets are labeled 0, 00, 1, 2, 3, 4, … , 36. Pockets 0 and 00 are green, and the other pockets
are alternately red and black.
The table
wheel
is a representation of a Nevada roulette wheel.
Note that
both
columns consist of strings.
Below is an example of a roulette wheel!
Run the cell below to load the
wheel
table.
[126]:
wheel
=
Table
.
read_table(
'roulette_wheel.csv'
, dtype
=
str
)
wheel
[126]:
Pocket | Color
00
| green
0
| green
1
| red
2
| black
3
| red
4
| black
5
| red
6
| black
7
| red
8
| black
… (28 rows omitted)
1.1.1
Betting on Red
If you bet on
red
, you are betting that the winning pocket will be red. This bet
pays 1 to 1
. That
means if you place a one-dollar bet on red, then:
• If the winning pocket is red, you gain 1 dollar. That is, you get your original dollar back,
plus one more dollar.
• If the winning pocket is not red, you lose your dollar. In other words, you gain -1 dollars.
2
Let’s see if you can make money by betting on red at roulette.
Question 1.
Define a function
dollar_bet_on_red
that takes the name of a color and returns
your gain in dollars if that color had won and you had placed a one-dollar bet on red. Remember
that the gain can be negative. Make sure your function returns an integer.
(4 points)
Note:
You can assume that the only colors that will be passed as arguments are red, black, and
green. Your function doesn’t have to check that.
[127]:
def
dollar_bet_on_red
(col):
#if(col == np.random.choice(wheel.column("Color"))):
if
(col
==
"red"
):
return
(
1
)
else
:
return
(
-1
)
[128]:
grader
.
check(
"q1_1"
)
[128]:
q1_1 results: All test cases passed!
Run the cell below to make sure your function is working.
[129]:
print
(dollar_bet_on_red(
'green'
))
print
(dollar_bet_on_red(
'black'
))
print
(dollar_bet_on_red(
'red'
))
-1
-1
1
Question 2.
Add a column labeled
Winnings: Red
to the table
wheel
.
For each pocket, the
column should contain your gain in dollars if that pocket won and you had bet one dollar on red.
Your code should use the function
dollar_bet_on_red
.
(4 points)
Hint:
You should not need a
for
loop for this question, instead try using a table method!
[130]:
red_winnings
=
wheel
.
apply(dollar_bet_on_red,
"Color"
)
wheel
=
wheel
.
with_column(
"Winnings: Red"
, red_winnings)
wheel
[130]:
Pocket | Color | Winnings: Red
00
| green | -1
0
| green | -1
1
| red
| 1
2
| black | -1
3
| red
| 1
4
| black | -1
5
| red
| 1
6
| black | -1
7
| red
| 1
3
8
| black | -1
… (28 rows omitted)
[131]:
grader
.
check(
"q1_2"
)
[131]:
q1_2 results: All test cases passed!
1.1.2
Simulating 10 Bets on Red
Roulette wheels are set up so that each time they are spun, the winning pocket is equally likely to
be any of the 38 pockets regardless of the results of all other spins. Let’s see what would happen
if we decided to bet one dollar on red each round.
Question 3.
Create a table
ten_bets
by sampling the table
wheel
to simulate 10 spins of the
roulette wheel.
Your table should have the same three column labels as in
wheel
.
Once you’ve
created that table, set
sum_bets
to your net gain in all 10 bets, assuming that you bet one dollar
on red each time.
(4 points)
Hint:
It may be helpful to print out
ten_bets
after you create it!
[132]:
ten_bets
=
wheel
.
sample(
10
)
sum_bets
=
np
.
sum(ten_bets
.
column(
'Winnings: Red'
))
sum_bets
[132]:
0
[133]:
grader
.
check(
"q1_3"
)
[133]:
q1_3 results: All test cases passed!
Run the cells above a few times to see how much money you would make if you made 10 one-dollar
bets on red. Making a negative amount of money doesn’t feel good, but it is a reality in gambling.
Casinos are a business, and they make money when gamblers lose.
Question 4.
Let’s see what would happen if you made more bets. Define a function
net_gain_red
that takes the number of bets and returns the net gain in that number of one-dollar bets on red.
(4 points)
Hint:
You should use your
wheel
table within your function.
[134]:
def
net_gain_red
(n):
n_bets
=
wheel
.
sample(n)
return
(np
.
sum(n_bets
.
column(
'Winnings: Red'
)))
[135]:
grader
.
check(
"q1_4"
)
[135]:
q1_4 results: All test cases passed!
Run the cell below a few times to make sure that the results are similar to those you observed in
the previous exercise.
4
[136]:
net_gain_red(
10
)
[136]:
0
Question 5.
Complete the cell below to simulate the net gain in 200 one-dollar bets on red,
repeating the process 10,000 times. After the cell is run,
simulated_gains_red
should be an array
with 10,000 entries, each of which is the net gain in 200 one-dollar bets on red.
(4 points)
Hint:
Think about which computational tool might be helpful for simulating a process multiple
times. Lab 5 might be a good resource to look at!
Note:
This cell might take a few seconds to run.
[137]:
num_bets
= 200
repetitions
= 10000
simulated_gains_red
=
[]
for
i
in
range
(repetitions):
simulated_gains_red
.
append(net_gain_red(num_bets))
len
(simulated_gains_red)
# Do not change this line! Check that
␣
↪
simulated_gains_red is length 10000.
[137]:
10000
Run the cell below to visualize the results of your simulation.
[138]:
gains
=
Table()
.
with_columns(
'Net Gain on Red'
, simulated_gains_red)
gains
.
hist(bins
=
np
.
arange(
-80
,
41
,
4
))
5
Question 6:
Using the histogram above, decide whether the following statement is true or false:
If you make 200 one-dollar bets on red, your chance of losing money is more than 50%.
Assign
loss_more_than_50
to either
True
or
False
depending on your answer to the question.
(2
points)
[139]:
loss_more_than_50
=
True
[140]:
grader
.
check(
"q1_6"
)
[140]:
q1_6 results: All test cases passed!
1.1.3
Betting on a Split
If betting on red doesn’t seem like a good idea, maybe a gambler might want to try a different bet.
A bet on a
split
is a bet on two consecutive numbers such as 5 and 6. This bets pays 17 to 1. That
means if you place a one-dollar bet on the split 5 and 6, then:
• If the winning pocket is either 5 or 6, your gain is 17 dollars.
• If any other pocket wins, you lose your dollar, so your gain is -1 dollars.
Question 7.
Define a function
dollar_bet_on_split
that takes a pocket number and returns
your gain in dollars if that pocket won and you had bet one dollar on the 5-6 split.
(4 points)
Hint:
Remember that the pockets are represented as strings.
6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
DESIGN YOUR OWN SETTING
Task 5: Devise your own setting for storing and searching the data in an array of non-negative integers redundantly. You may just describe the setting without having to give an explicit algorithm to explain the process by which data is stored. You should explain how hardware failures can be detected in your method. Once you have described the setting, complete the following:
Write a pseudocode function to describe an algorithm where the stored data can be searched for a value key: if the data is found, its location in the original array should be returned; -1 should be returned if the data is not found; -2 should be returned if there is a data storage error
Include a short commentary explaining why your pseudocode works
Describe the worst-case and best-case inputs to your search algorithm
Derive the worst-case and best-case running times for the search algorithm
Derive the Theta notation for the worst-case and best-case running times
Maximum word…
arrow_forward
C++ Progrmaing
Instructions
Redo Programming Exercise 6 of Chapter 8 using dynamic arrays. The instructions have been posted for your convenience.
The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first entry in the file contains answers to the test in the form:
TFFTFFTTTTFFTFTFTFTT
Every other entry in the file is the student ID, followed by a blank, followed by the student’s responses. For example, the entry:
ABC54301 TFTFTFTT TFTFTFFTTFT
indicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9 (note the empty space). The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero points. Write a program that processes the test data. The output should be the student’s ID,…
arrow_forward
Please give me correct solution.
arrow_forward
Array Challenge
4. Write a program in C# to copy the elements of one array into another array.Test Data :Input the number of elements to be stored in the array :3Input 3 elements in the array :element - 0 : 15element - 1 : 10element - 2 : 12Expected Output :The elements stored in the first array are :15 10 12The elements copied into the second array are :15 10 12
arrow_forward
T or F
-Functions are considered to be objects in JavaScript because they contain three critical attributes: data, methods that act on the data, parameters for passing the data also known as awareness.
-A recursive function is a function that calls itself and eventually returns default value to break out of the recursion.
-A function that is used to create a new object is called an anonymous function.
-Attributes define additional characteristics or properties of the element which is the same as for the start tag.
-Javascript is similar to the Java programming language
arrow_forward
Finding the common members of two dynamic arrays: Write a program that first reads two arrays and then finds their common members (intersection). The program should first read an integer for the size of the array and then should create the two arrays dynamically (using new) and should read the numbers into array1 and array2 and then should find the common members and show it.
Note: The list of the common members should be unique. That is no member should be listed more than once.
Tip: A simple for loop is needed on one of the arrays (like array1) and one inner for loop for on array2. Then for each member of array1, if we find any matching member in array2, we record it.
Sample run:
Enter the number of elements of array 1: 7
Enter the elements of array 1: 10 12 13 10 14 15 12
Enter the number of elements of array 2: 5
Enter the elements of array 2: 17 12 10 19 12
The common members of array1 and array2 are: 12 10
arrow_forward
please code in python
Forbidden concepts: arrays/lists (data structures), recursion, custom classes
Watch this video on the Fibonacci sequence. The first two numbers of the sequence are 1 and 1. The subsequent numbers are the sum of the previous two numbers. Create a loop that calculates the Fibonacci sequence of the first 25 numbers and prints each one.Lastly, state the 25th and 24th sequence in a sentence, and explain how the golden ratio is conducted from it, including what it is.Note: you don’t know what the 24th and 25th numbers are, get the program to find out and calculate itself what the ratio is.
arrow_forward
Duplicate Count
Code in C Language
arrow_forward
I need a code of this in C language.
Input
1. Number of rows
Constraints
The value is guaranteed to be >= 3 and <= 100.
Sample
3
2. Number of columns
Constraints
The value is guaranteed to be >= 3 and <= 100.
Sample
3
3. Elements
Description
The elements of the multidimensional array depending on the number of rows and columns
Constraints
All elements are non-negative and are all less than 100.
Output
The first line will contain a message prompt to input the number of rows. The second line will contain a message prompt to input the number of columns. The succeeding lines will contain message prompts for the elements of the multidimensional array. Lastly, a blank line is printed before the rotated 90-degrees anti-clockwise 2D array.
For example this should be the output.
Enter the number of rows: 3
Enter the number of columns: 3
Row #1: 1 2 3
Row #2:·4 5 6
Row #3: 7 8 9
3 6 9
2 5 8
1 4 7
arrow_forward
Please add an execution chart for this code like the example below. I have provided the code and the example execution chart. :
Sample Execution Chart Template//your header files// constant size of the array// declare an array of BankAccount objects called accountsArray of size =SIZE// comments for other declarations with variable names etc and their functionality// function prototypes// method to fill array from file, details of input and output values and purpose of functionvoid fillArray (ifstream &input,BankAccount accountsArray[]);// method to find the largest account using balance as keyint largest(BankAccount accountsArray[]);// method to find the smallest account using balance as keyint smallest(BankAccount accountsArray[]);// method to display all elements of the accounts arrayvoid printArray(BankAccount accountsArray[]);int main() {// function calls come here:// give the function call and a comment about the purpose,// and input and return value if any//open file//fill…
arrow_forward
def drop_uninformative_objects(X, y):# your code herereturn X_subset, y_subset
# TEST drop_uninformative_objects functionA = pd.DataFrame(np.array([[0, 3, np.nan],[4, np.nan, np.nan],[np.nan, 6, 7],[np.nan, np.nan, np.nan],[5, 5, 5],[np.nan, 8, np.nan],]))b = pd.Series(np.arange(6))A_subset, b_subset = drop_uninformative_objects(A, b)
assert A_subset.shape == (3, 3)assert b_subset.shape == (3,)
arrow_forward
C++
Write a program that will allow a user to enter students into a database.
The student information should include full name, student ID, GPA and status.
The program should allow delete any student based on student ID. You may not use a vecto or an array only the list function.
arrow_forward
Write JAVA code
General Problem Description:
It is desired to develop a directory application based on the use of a double-linked list data structure, in which students are kept in order according to their student number. In this context, write the Java codes that will meet the requirements given in detail below.
Requirements:
Create a class named Student to represent students. In the Student class; student number, name and surname and phone numbers for communication are kept. Student's multiple phones
number (multiple mobile phones, home phones, etc.) so phone numbers information will be stored in an “ArrayList”. In the Student class; parameterless, taking all parameters and
It is sufficient to have 3 constructor methods, including a copy constructor, get/set methods and toString.
arrow_forward
Question 18
An array in Java programming language has the ability to store the same type of values.
True
False
arrow_forward
Create class called Student:Attributes:
char * street
char * city
char * state
char * studentName
long id
Create a class with main:
The program will ask the student for information and then print it out in the terminal.
Using dynamic memory to create an array.
Implementing a menu:
Add Student
Search for Student
Show List of Students
Exit
Your program should be modular.
Answer without using string and implement a dynamic array in c++
arrow_forward
By python
arrow_forward
Array Challenge
5. Write a program in C# to count a total number of duplicate elements in an array.Test Data :Input the number of elements to be stored in the array :3Input 3 elements in the array :element - 0 : 5element - 1 : 1element - 2 : 1Expected Output :Total number of duplicate elements found in the array is : 1
arrow_forward
Q# 3: Write the pre and post-conditions for the following design specification:
A procedure search has three parameters: arr, lookfor, and found. Parameter arr is an integer
array with a range of 1 .. 200. Parameter lookfor is an integer parameter. If lookfor occur in arr
then found is set to one otherwise, it is set to zero.
arrow_forward
3 : calculate the avg of each student and print it as :
the avg for Sara is : 84.66.
<?php $marks = array(
"Sara" => array(
"Programming" => 95,
"DataBase" => 85,
"Web" => 74,
),
"Diana" => array(
"Programming" => 78,
"DataBase" => 98,
"Web" => 66,
),
"Amy" => array(
"Programming" => 88,
"DataBase" => 76,
"Web" => 99,
),
);
?>
arrow_forward
Write a program in Java, Python and Lisp
When the program first launches, there is a menu which allows the user to select one of the following five options:
1.) Add a guest
2.) Add a room
3.) Add a booking
4.) View bookings
5.) Quit
The functionality of these options is as follows:
1.) When users add a guest they provide a name which is stored in some manner of array or list. Guests are assigned a unique ID value where the first guest added is assigned the ID value 1, the second guest added is assigned the ID value 2 and so on.
2.) When users add a room they provide a room number and a room capacity (i.e. how many people can stay in the room at any one time) which is stored in some manner of array or list. Rooms have a property which indicates if they are booked or not for any given date – please see the Room Booking Dates section below for some guidance on the easiest way to implement this.
3.) When users add a booking they provide a guest ID, room number, the number…
arrow_forward
In statistics, the mode of a set of values is the value that occurs most often or with the greatest frequency. Write a function that accepts as arguments the following: A) An array of integers B) An integer that indicates the number of elements in the array The function should determine the mode of the array. That is, it should determine which value in the array occurs most often. The mode is the value the function should return. If the array has no mode (none of the values occur more than once), the function should return −1. (Assume the array will always contain non negative values.) Demonstrate your pointer prowess by using pointer notation instead of array notation in this function.
arrow_forward
# dates and times with lubridateinstall.packages("nycflights13")
library(tidyverse)library(lubridate)library(nycflights13)
Qustion:
Create a function called date_quarter that accepts any vector of dates as its input and then returns the corresponding quarter for each date
Examples:
“2019-01-01” should return “Q1”
“2011-05-23” should return “Q2”
“1978-09-30” should return “Q3”
Etc.
Use the flight's data set from the nycflights13 package to test your function by creating a new column called quarter using mutate()
arrow_forward
Two dimension array in C:Create a two dimension array of integers that is 5 rows x 10 columns.Populate each element in the first 2 rows (using for loops) with the value 5.Populate each element of the last three rows (using for loops) with the value 7.Write code (using for loops) to sum all the elements of the first three columns and output thesum to the screen.
without using #define
arrow_forward
Problem Attached
arrow_forward
C# Programming
See attached photo for the problem needed to be fixed.
Please make my code correct without changing the IEnumerable<string> in the function because it is crucial to my code. I need this code to be corrected and if you do, I owe you a big thank you and good rating. Thank you so much for your help in advance!
arrow_forward
Python
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Related Questions
- DESIGN YOUR OWN SETTING Task 5: Devise your own setting for storing and searching the data in an array of non-negative integers redundantly. You may just describe the setting without having to give an explicit algorithm to explain the process by which data is stored. You should explain how hardware failures can be detected in your method. Once you have described the setting, complete the following: Write a pseudocode function to describe an algorithm where the stored data can be searched for a value key: if the data is found, its location in the original array should be returned; -1 should be returned if the data is not found; -2 should be returned if there is a data storage error Include a short commentary explaining why your pseudocode works Describe the worst-case and best-case inputs to your search algorithm Derive the worst-case and best-case running times for the search algorithm Derive the Theta notation for the worst-case and best-case running times Maximum word…arrow_forwardC++ Progrmaing Instructions Redo Programming Exercise 6 of Chapter 8 using dynamic arrays. The instructions have been posted for your convenience. The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first entry in the file contains answers to the test in the form: TFFTFFTTTTFFTFTFTFTT Every other entry in the file is the student ID, followed by a blank, followed by the student’s responses. For example, the entry: ABC54301 TFTFTFTT TFTFTFFTTFT indicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9 (note the empty space). The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero points. Write a program that processes the test data. The output should be the student’s ID,…arrow_forwardPlease give me correct solution.arrow_forward
- Array Challenge 4. Write a program in C# to copy the elements of one array into another array.Test Data :Input the number of elements to be stored in the array :3Input 3 elements in the array :element - 0 : 15element - 1 : 10element - 2 : 12Expected Output :The elements stored in the first array are :15 10 12The elements copied into the second array are :15 10 12arrow_forwardT or F -Functions are considered to be objects in JavaScript because they contain three critical attributes: data, methods that act on the data, parameters for passing the data also known as awareness. -A recursive function is a function that calls itself and eventually returns default value to break out of the recursion. -A function that is used to create a new object is called an anonymous function. -Attributes define additional characteristics or properties of the element which is the same as for the start tag. -Javascript is similar to the Java programming languagearrow_forwardFinding the common members of two dynamic arrays: Write a program that first reads two arrays and then finds their common members (intersection). The program should first read an integer for the size of the array and then should create the two arrays dynamically (using new) and should read the numbers into array1 and array2 and then should find the common members and show it. Note: The list of the common members should be unique. That is no member should be listed more than once. Tip: A simple for loop is needed on one of the arrays (like array1) and one inner for loop for on array2. Then for each member of array1, if we find any matching member in array2, we record it. Sample run: Enter the number of elements of array 1: 7 Enter the elements of array 1: 10 12 13 10 14 15 12 Enter the number of elements of array 2: 5 Enter the elements of array 2: 17 12 10 19 12 The common members of array1 and array2 are: 12 10arrow_forward
- please code in python Forbidden concepts: arrays/lists (data structures), recursion, custom classes Watch this video on the Fibonacci sequence. The first two numbers of the sequence are 1 and 1. The subsequent numbers are the sum of the previous two numbers. Create a loop that calculates the Fibonacci sequence of the first 25 numbers and prints each one.Lastly, state the 25th and 24th sequence in a sentence, and explain how the golden ratio is conducted from it, including what it is.Note: you don’t know what the 24th and 25th numbers are, get the program to find out and calculate itself what the ratio is.arrow_forwardDuplicate Count Code in C Languagearrow_forwardI need a code of this in C language. Input 1. Number of rows Constraints The value is guaranteed to be >= 3 and <= 100. Sample 3 2. Number of columns Constraints The value is guaranteed to be >= 3 and <= 100. Sample 3 3. Elements Description The elements of the multidimensional array depending on the number of rows and columns Constraints All elements are non-negative and are all less than 100. Output The first line will contain a message prompt to input the number of rows. The second line will contain a message prompt to input the number of columns. The succeeding lines will contain message prompts for the elements of the multidimensional array. Lastly, a blank line is printed before the rotated 90-degrees anti-clockwise 2D array. For example this should be the output. Enter the number of rows: 3 Enter the number of columns: 3 Row #1: 1 2 3 Row #2:·4 5 6 Row #3: 7 8 9 3 6 9 2 5 8 1 4 7arrow_forward
- Please add an execution chart for this code like the example below. I have provided the code and the example execution chart. : Sample Execution Chart Template//your header files// constant size of the array// declare an array of BankAccount objects called accountsArray of size =SIZE// comments for other declarations with variable names etc and their functionality// function prototypes// method to fill array from file, details of input and output values and purpose of functionvoid fillArray (ifstream &input,BankAccount accountsArray[]);// method to find the largest account using balance as keyint largest(BankAccount accountsArray[]);// method to find the smallest account using balance as keyint smallest(BankAccount accountsArray[]);// method to display all elements of the accounts arrayvoid printArray(BankAccount accountsArray[]);int main() {// function calls come here:// give the function call and a comment about the purpose,// and input and return value if any//open file//fill…arrow_forwarddef drop_uninformative_objects(X, y):# your code herereturn X_subset, y_subset # TEST drop_uninformative_objects functionA = pd.DataFrame(np.array([[0, 3, np.nan],[4, np.nan, np.nan],[np.nan, 6, 7],[np.nan, np.nan, np.nan],[5, 5, 5],[np.nan, 8, np.nan],]))b = pd.Series(np.arange(6))A_subset, b_subset = drop_uninformative_objects(A, b) assert A_subset.shape == (3, 3)assert b_subset.shape == (3,)arrow_forwardC++ Write a program that will allow a user to enter students into a database. The student information should include full name, student ID, GPA and status. The program should allow delete any student based on student ID. You may not use a vecto or an array only the list function.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education