题目内容

Correct the following codes so that the list ls contains numbers 0,1,2,3,4.改正下列代码使得列表ls为[0,1,2,3,4]。ls = []for i in range(5):ls[i] = i

查看答案
更多问题

Correct the following codes to reverse s.改正下列代码将字符串s逆序。s = 'Life is short, you need Python.'s.reverse()print(s)

Correctthefollowingcodestoprintthesortedlist,i.e.,[1,2,4,5,9].改正下列代码输出递增的值1,2,4,5,9。ls=[5,2,9,1,4]foriteminls.sort():print(item)

Correct the following codes to print the string"I am 18 years old."改正下列代码输出字符串"I am 18 years old."age = 18print("I am "+ age + " years old.")

Correct the syntex error in the following codes.改正下列代码中的语法错误。x = eval(input('input a number: '))if x<0:y = -1elif x = 0:y = 0else:y = 1print('y = ', y)

答案查题题库