fork download
  1. nums = [5, 12, 7, 9, 21, 7, 14]
  2. aa = nums.count(7)
  3. print("数字出现次数:",aa)
  4. if 99 not in nums:
  5. nums.append(99)
  6. print("最新列表1:",nums)
  7.  
  8. bb = nums.remove(7)
  9. print("最新列表2",nums)
  10. cc = nums[1:4]
  11. print("第2-4元素:",cc)
  12.  
  13.  
  14. msg = "hello 123 WORLD"
  15. dd = len(msg)
  16. print("长度:",dd)
  17. ff = sum(1 for ch in msg if ch.islower())
  18. print("小写字母个数:",ff)
Success #stdin #stdout 0.07s 14132KB
stdin
Standard input is empty
stdout
数字出现次数: 2
最新列表1: [5, 12, 7, 9, 21, 7, 14, 99]
最新列表2 [5, 12, 9, 21, 7, 14, 99]
第2-4元素: [12, 9, 21]
长度: 15
小写字母个数: 5