Please correct the errors in each problem. There are syntax errors, logical errors and runtime errors
1
x = 'hello'
y = ['hello']
if x == y(0):
print('Equal')
2
x = 'hello'
y = ['hello']
z = x + y
z.sort()
3
x = 'hello'
y = ['hello', 'goodbye']
print(x+y)
4
x = 'hello'
y = ['hello', 'goodbye']
print(x+y[1])
6.
def myfunction(x, y):
return x + y
myfunction(1)
7.
def myfunction(x, y):
return x + y
myfunction(x=1, 5)
8.
myList = [1, 5, 10]
print(myList[3])
9.
myList = list(range(0,10))
print(myList[0] + myList[10])
10.
myList = list(range(0,10))
for x in myList:
print(myList[x]/myList[x-1])
11.
for x list(range(0,10)):
print(x)
12.
def recurseMe(x, y):
return recurseMe(x-1 * y -1, x)
def main():
print(recurseMe(1,2))
main()
I would really appreciate your help!
#1
x = 'Hello'
y = 'Hello'
if x = y[0]:
print('Equal')
#2
x = 'Hello'
y = ['hello']
z = [x] + y
z.sort()
#3
x = 'hello'
y = ['Hello']
print(y+[x])
#4
x = 'hello'
y = ['hello','goodbye']
print(x +' '+ y[1])
#6
def MyFunction(x,y):
return x + y
MyFunction(1,2)
#7
def MyFunction(x,y):
return x + y
MyFunction(1,5)
#8
myList = [1, 5, 10]
print(myList[2])
#9
myList = list(range(0,10))
print(myList[0] + myList[9])
#10
myList = list(range(0,10))
for x in myList:
if x == 0:
x==-1
print(myList[x]/myList[x-1])
#11
for x in range(0,10):
print(x)
#12
def recurseMe(x, y):
return (x-1*y -1,x)
def main():
print(recurseMe(1,2))
main()
Comments
Leave a comment