+1

I want to write a code in phyton that prints only letters from input but skips two and prints one.

I want my program to do this; input = 2ab4c#fd56gjl output = afj So it should completely ignore any character other than letters and print the letters by skipping 2. Is there a way to do it? Should i use for loop?

10/15/2019 10:48:55 AM

Apate

13 Answers

New Answer

+2

Here I give you an example. If you have problems with understanding it then you may ask. https://code.sololearn.com/cawbak7t8IV0/?ref=app

+3

1) post your attempt first 2) For loop is neccecary (2 I think)

+3

Just try using for-loops first (Hint: the 3rd parameter in the range() function is the step)

+3

After doing half of the python course you have definitely have enough knowledge to write the above program. If you have forgotton please revise it. You need to work more on your logic part.

+3

Hello, 😊 If you need help, you can post the code you're struggling with!  • SEARCH for similar QUESTIONS or ANSWERS before posting  • https://www.sololearn.com/post/75089/?ref=app

+2

If you show us your attempt first, and admit you are completely stumped, message me and Ill send you a solution

+2

here some good resource https://www.pythonforbeginners.com/basics/list-comprehensions-in-python https://stackoverflow.com/questions/2990121/how-do-i-loop-through-a-list-by-twos#2990152

+1

Here I have another example using regular expressions. This works without loops: https://code.sololearn.com/cSCh9hBauvBe/?ref=app

+1

I would do it with a foor loop; then a if conditional as : if letter in "1234567890":, etc

0

joao vitor your solution will only work for numbers. What about special characters?

0

actually would be better to use isalpha()

0

There ya go👍🏼

-1

Well I am already saying that i need help and cant do it by loading my question here, what else do you want me to admit? I dont have an attempt because i dont have enough knowledge to proceed.