0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Codewars 8 kyu Contamination #1 -String-

Posted at

Codewars 8 kyu Contamination #1 -String-

Verbalization

  1. textの文字数を数える
  2. 1で数えた文字数分、charの文字を返す

Code

def contamination(text, char):
    n=len(text)
    return n*char

Other example

for文を使うバージョン(ループで1文字ずつ足していく書き方)

def contamination(text, char):
    A = “”
    For i in text:
        A += char
    return A

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?