Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions