Why this is wrong? | SoloLearn: Learn to code for FREE!

+1

Why this is wrong?

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

5/20/2020 2:23:19 AM

Mohan 333

8 Answers

New Answer

+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++)

+1

What is the output, you looking for?

0

Mr. 🍊range https://www.sololearn.com/coach/55?ref=app

0

Mohan 333 Use isalpha () to check a character is a letter or not

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

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

0

In point (4) I suggested to remove the indentation of print(), not to remove the whole line 😅

0

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