fork download
  1. words = ["python", "ai", "machine learning", "data", "nlp"]
  2. longest = words[ 0 ]
  3. for w in words :
  4. if len (w) > len(longest):
  5. longest = w
  6. print(f'最长的字符串是"{ longest }",长度为{ len(longest) }')
  7. # your code goes here
Success #stdin #stdout 0.07s 7988KB
stdin
Standard input is empty
stdout
最长的字符串是"machine learning",长度为16