Question: q1- Which of the following code snippets uses Python to define a function called upper_slice, which takes in a string and an integer as arguments

q1- Which of the following code snippets uses Python to define a function called upper_slice, which takes in a string and an integer as arguments and returns the string slice up until the index of that integer, converted to all caps? Sample input 1: 'Greetings', 5 Sample output 1: 'GREET' Sample input 2: 'Hello, World!', 2 Sample output 2: 'HE'

Group of answer choices

None of these

def upper_slice(text, number) text[0,number].upcase end

def upper_slice(text, number): return text[:number].upper()

function upper_slice(text, number) { return text.slice(0, 5).toUpperCase(); }

def upper_slice(text): return text.upper()

q2-

escribe what the following line of code is doing: np.corrcoef(x, y) You can assume that it is part of a larger body of code where np, x, and y have been defined

Group of answer choices

Using the NumPy library (imported as alias np) to find the Pearson correlation between x and y

Using base Python built-in functions to find the covariance between x and y

This code would throw an error; there is no np.corrcoef function

None of these

Using base Python built-in functions to find the Pearson correlation between x and y

Using the NumPy library (imported as alias np) to find the covariance between x and y

q3-

Looking at the histogram below, would we expect the mean and median values to be significantly different? (Here we can define "significantly different" to mean they differ by more than 1.)

Group of answer choices

Yes

No

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!