replace 10

0107. Exclamation marks series #4: Remove all exclamation marks from sentence but ensure a exclamation mark at the end of string

Description: Remove all exclamation marks from sentence but ensure a exclamation mark at the end of string. For a beginner kata, you can assume that the input data is always a non empty string, no need to verify it. Examples remove("Hi!") === "Hi!" remove("Hi!!!") === "Hi!" remove("!Hi") === "Hi!" remove("!Hi!") === "Hi!" remove("Hi! Hi!") === "Hi Hi!" remove("Hi") === "Hi!" Solution: const remo..

1114. Exclamation marks series #6: Remove n exclamation marks in the sentence from left to right

Description: Remove n exclamation marks in the sentence from left to right. n is positive integer. Examples remove("Hi!",1) === "Hi" remove("Hi!",100) === "Hi" remove("Hi!!!",1) === "Hi!!" remove("Hi!!!",100) === "Hi" remove("!Hi",1) === "Hi" remove("!Hi!",1) === "Hi!" remove("!Hi!",100) === "Hi" remove("!!!Hi !!hi!!! !hi",1) === "!!Hi !!hi!!! !hi" remove("!!!Hi !!hi!!! !hi",3) === "Hi !!hi!!! !..

Python _ zoneinfo 사용법, ZoneInfo 와 pytz 차이

ZoneInfo 을 사용하면 기존 pytz를 사용하지 않고도 타임존을 사용할 수 있다! (*ZoneInfo 는 Python3.9 버전 이상부터 사용가능) 'ZoneInfo' vs 'pytz' 그렇다면 ZoneInfo 와 pytz 는 어떤 차이가 있을까? 우선 ZoneInfo 는 따로 설치할 필요가 없는 빌트인 클래스이므로 다음처럼 간단하게 불러올 수 있다. from zoneinfo import ZoneInfo ZoneInfo 와 pytz 를 각각 사용해 현재시간을 가져와보자. pytztz = timezone("Asia/Seoul") zonetz = ZoneInfo("Asia/Seoul") print(datetime.datetime.now(tz=pytztz).tzname()) print(datetime.d..

0831. Correct the mistakes of the character recognition software

Character recognition software is widely used to digitise printed texts. Thus the texts can be edited, searched and stored on a computer. When documents (especially pretty old ones written with a typewriter), are digitised character recognition softwares often make mistakes. Your task is correct the errors in the digitised text. You only have to handle the following mistakes: S is misinterpreted..