Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

edhesive 1.6 code practice answers
Consider the following lines of Python code.

x = [13,4,17,1000]
w = x[1:]
u = x[1:]
y = x
u[0] = 50
y[1] = 40
Which of the following is correct?


x[1] == 40, y[1] == 40, w[0] == 4, u[0] == 50

x[1] == 50, y[1] == 40, w[0] == 50, u[0] == 50

x[1] == 4, y[1] == 40, w[0] == 4, u[0] == 50

x[1] == 40, y[1] == 40, w[0] == 50, u[0] == 50
One of the following 10 statements generates an error. Which one? (Your answer should be a number between 1 and 10.)

x = [1,"abcd",2,"efgh",[3,4]] # Statement 1
y = x[0:50] # Statement 2
z = y # Statement 3
w = x # Statement 4
x[1] = x[1] + 'd' # Statement 5
y[2] = 4 # Statement 6
x[1][1] = 'y' # Statement 7
z[0] = 0 # Statement 8
w[4][0] = 1000 # Statement 9
a = (x[4][1] == 4)
Write a program that uses two input statements to get two as input. Then, print the word on one line separated by a space
Mr. John wants to calculate the total marks and average marks for his class of 5 students
for Maths, Science and Geography (for each subject). Write down coding that will help
him to accomplish this task using while loop
def mystery(l):
l = l + l
return()

mylist = [22,34,57]
mystery(mylist)
Consider the following function f.

def f(m):
if m == 0:
return(0)
else:
return(m+f(m-1))
Which of the following is correct?

The function always terminates with f(n) = factorial of n
The function always terminates with f(n) = n(n+1)/2
The function terminates for nonĀ­negative n with f(n) = factorial of n
The function terminates for nonĀ­negative n with f(n) = n(n+1)/2
Consider the following function f.

def f(n):
s=0
for i in range(1,n+1):
if n%i == 0:
s = s+1
return(s%2 == 1)
The function f(n) given above returns True for a positive number n if and only if:

n is an odd number.
n is a prime number.
n is a composite number.
n is a perfect square.
What is g(24) - g(23), given the definition of g below?

def g(n):
s=0
for i in range(1,n+1):
if n%i == 0:
s = s+1
return(s)
What does h(3231) return for the following function definition?

def h(x):
(m,a) = (1,0)
while m <= x:
(m,a) = (m*2,a+1)
return(a)
LATEST TUTORIALS
APPROVED BY CLIENTS