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