fork download
  1. a='sentence'
  2. print(a[3])
  3. fruits=['苹果','栗子','荔枝','梨子']
  4. print(fruits)
  5. words=['python','ai','date','abc','efghj','machine learning']
  6. longest=words[0]
  7. for x in words:
  8. if len(x)>len(longest):
  9. longest=x
  10. print(f"最长的字符串是'{longest}',长度为{len(longest)}")
Success #stdin #stdout 0.07s 14176KB
stdin
Standard input is empty
stdout
t
['苹果', '栗子', '荔枝', '梨子']
最长的字符串是'machine learning',长度为16