+ 3

Why this is wrong?

Why it is display wrong output? https://code.sololearn.com/cQVjQ5HJ8NM5/?ref=app

20th May 2020, 2:23 AM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
8 Answers
+ 1
Ok, now I see, you want to remove the digits too... Ok, let's add a fifth error 🙄 (5) --> "i in range (0,10)" will not remove any digit, but just the improbable values 0-10 so replace it with i.isdigit() or consider the good suggestion of 𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 A final hint: try to solve your problems by yourself as strongest as you can, with the only help of google... this way you will remember the solutions for a longer time. Happy pythoning (without forgetting C++)
20th May 2020, 4:32 AM
Bilbo Baggins
Bilbo Baggins - avatar
+ 2
In c++ i can print the last result after the for loop or any loop.But in python i can't print the result after the for loop. https://code.sololearn.com/cQVjQ5HJ8NM5/?ref=app Now is it correct? Else type correct code pls
20th May 2020, 4:11 AM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
+ 1
What is the output, you looking for?
20th May 2020, 2:38 AM
KingDaniel2004
KingDaniel2004 - avatar
0
Mohan 333 Use isalpha () to check a character is a letter or not
20th May 2020, 3:04 AM
Prince Kumar
Prince Kumar - avatar
0
Your code has some errors, let see them... (1) if i in listo or range(0,10): this condition is always satisfied, because range(0,10) is always True correct with: if i in listo or i in range(0,10) (2) m.replace(m,"") replace does not operates in place, this means that it does nothing if you do not reassign it; and you do not want to replace the whole string, else it will be emptied. correct with: m = m.replace(i,"") (3) else: pass that's not an error, but it is useless: you can remove it (4) print(m) you do not want to print the result at every loop, but only at the end of them: unindent it
20th May 2020, 3:18 AM
Bilbo Baggins
Bilbo Baggins - avatar
0
Bilbo Baggins now i corrected it.But it is not print the output if it is wrong type the correct code please https://code.sololearn.com/cQVjQ5HJ8NM5/?ref=app
20th May 2020, 3:59 AM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
0
In point (4) I suggested to remove the indentation of print(), not to remove the whole line 😅
20th May 2020, 4:04 AM
Bilbo Baggins
Bilbo Baggins - avatar