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.  
Success #stdin #stdout 0.07s 14200KB
stdin
汤旭
stdout
最长的字符串是"machine learning",长度为16