Correct the following code to calculate the sum of 0 to 9.改正下列代码求整数1-9的和。sum=0foriinrange(1,9):sum+=i
查看答案
Correct the follwing code to print the string 'Hello'.改正下列代码,输出字符串'Hello'。s = 'hello's[0]='H'print(s)
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)