4 Respuestas
+ 3
I tried this and it works:
word = "Canada"
letters = []
for i in word:
letters.append(i)
letter = input()
whattoprint = []
for i in letters:
if i == letter:
whattoprint.append(i)
else:
whattoprint.append("-")
print("".join(whattoprint))
I hope this is helpful!
+ 2
Try this:
word = 'Canada'
letter = 'd'
newword = ''
for i in word:
if i != letter:
newword += '-'
else:
newword += i
print(newword)
https://code.sololearn.com/c9aHlq6kmh3b/?ref=app
+ 2
I had tried this,
https://code.sololearn.com/cL0MRy3TS8wJ/?ref=app
0
it doesn’t work.