fork download
  1. msg = "hello 123 WROLD"
  2. length = len(msg)
  3. lower_count = sum(1 for ch in msg if ch.islower())
  4. print("长度:",length)
  5. print("小写字母个数:",lower_count)
  6.  
  7. new_msg = msg.replace("WROLD","Pyhon")
  8. result = new_msg.lower()
  9. print("结果:",result)
Success #stdin #stdout 0.07s 14144KB
stdin
Standard input is empty
stdout
长度: 15
小写字母个数: 5
结果: hello 123 pyhon