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

Write a function intreverse(n) that takes as input a positive integer n and returns the integer obtained by reversing the digits in n.

Here are some examples of how your function should work.

>>> intreverse(783)
387
>>> intreverse(242789)
987242
>>> intreverse(3)
3
What is the value of h(231,8) for the function below?

def h(m,n):
ans = 0
while (m >= n):
(ans,m) = (ans+1,m-n)
return(ans)
when opening a file, the “wt” parameter indicated that we:


want to append to the end of the text file.



want to write data to a text file.


that we are opening a binrary file.


that we are reading from a text file.
What is the value of h(231,8) for the function below?
def h(m,n):
ans = 0
while (m >= n):
(ans,m) = (ans+1,m-n)
return(ans)
What is the value of h(231,8) for the function below?
def h(m,n):
ans = 0
while (m >= n):
(ans,m) = (ans+1,m-n)
return(ans)
What is the value of h(231,8) for the function below?
def h(m,n):
ans = 0
while (m >= n):
(ans,m) = (ans+1,m-n)
return(ans)
What is the value of mylist after the following lines are executed?
def mystery(l):
l = l + l
return()

mylist = [31,24,75]
mystery(mylist)
What is the value of endmsg after executing the following lines?
startmsg = "hello"
endmsg = ""
for i in range(0,len(startmsg)):
endmsg = startmsg[i] + endmsg
2.5 points
2.5 points
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?

1) x[1] == 40, y[1] == 40, w[0] == 50, u[0] == 50
2) x[1] == 4, y[1] == 40, w[0] == 4, u[0] == 50
3) x[1] == 50, y[1] == 50, w[0] == 50, u[0] == 50
4) x[1] == 40, y[1] == 40, w[0] == 4, 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
x[1][1] = 'y' # Statement 6
y[2] = 4 # Statement 7
z[0] = 0 # Statement 8
w[4][0] = 1000 # Statement 9
a = (x[4][1] == 4) # Statement 10
LATEST TUTORIALS
APPROVED BY CLIENTS