+ 1

Why is it giving no output

letter ="qwertpoiuyasdfglkjhzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM" msg = "jagwuwbs72628+2-#:" ans = "" for x in msg: if x in letter: ans + x continue print(ans)

4th Dec 2021, 2:11 PM
Musharraf
Musharraf - avatar
3 ответов
+ 3
ans = "" You print an empty string. Make it ans = ans + x And what is the continue supposed to do?
4th Dec 2021, 2:17 PM
Paul
Paul - avatar
+ 3
Thanks
4th Dec 2021, 2:20 PM
Musharraf
Musharraf - avatar
+ 2
It had a reason. But not now
4th Dec 2021, 2:21 PM
Musharraf
Musharraf - avatar