I want to write a code in phyton that prints only letters from input but skips two and prints one. | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 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?

15th Oct 2019, 10:48 AM
Apate
10 Respuestas
+ 3
1) post your attempt first 2) For loop is neccecary (2 I think)
15th Oct 2019, 10:50 AM
Trigger
Trigger - avatar
+ 3
Just try using for-loops first (Hint: the 3rd parameter in the range() function is the step)
15th Oct 2019, 11:06 AM
Trigger
Trigger - avatar
+ 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
15th Oct 2019, 2:30 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 2
If you show us your attempt first, and admit you are completely stumped, message me and Ill send you a solution
15th Oct 2019, 10:59 AM
Trigger
Trigger - avatar
+ 1
I would do it with a foor loop; then a if conditional as : if letter in "1234567890":, etc
16th Oct 2019, 12:00 PM
joao vitor
joao vitor - avatar
0
joao vitor your solution will only work for numbers. What about special characters?
16th Oct 2019, 12:26 PM
Trigger
Trigger - avatar
0
actually would be better to use isalpha()
16th Oct 2019, 12:30 PM
joao vitor
joao vitor - avatar
0
There ya go👍🏼
16th Oct 2019, 12:30 PM
Trigger
Trigger - avatar
- 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.
15th Oct 2019, 11:04 AM
Apate