三是求单词的长度并排序,四是求曼哈顿距离,尽量简易易懂,且第四题尽量使用for循环,大概就是这样了
//3.输入多个以逗号分隔的单词,按字母顺序排序
words = input().split(',')
words.sort()
print(words)
//4.
p1 = list(eval(input('enter the coordinates of the first point (separated by commas):')))
p2 = list(eval(input('enter the coordinates of the second point (separated by commas):')))
s = 0
for i in range(0,len(p1)):
s = s + abs(p1[i]-p2[i])
print(s)
不知道你这个问题是否已经解决, 如果还没有解决的话: