0023-编程打卡:HaHaHahahahaHa中有几个人?
本帖最后由 不二如是 于 2022-9-20 19:31 编辑**** Hidden Message *****
一星答案:
from unittest import result
def kooka_counter(laughing):
temp = ''
count = 0
for i in range(0, len(laughing), 2):
if temp != laughing:
temp = laughing
count += 1
return count
result = kooka_counter("hahahahahahahaHaHa")
print(f"共有{result}位")
二星答案:
def kooka_counter(laughing):
laughing = laughing.replace('a', '')
if laughing:
count = 1
for i in range(len(laughing) - 1):
if laughing != laughing:
count += 1
return count
else:
return 0
三星答案:
**** Hidden Message *****
基础语法:
https://www.bilibili.com/video/BV1c4411e77t
算法讲解:
https://www.bilibili.com/video/BV1HT4y1K7DY
HaHaHahahaHahaHaHahahaHa {:5_108:} {:5_108:}
页:
[1]