0

Possible methods for use in if or statement

This was an exercise for codecoach 'spy life". I wanted to use an if statement within a list comprehension but I'm having trouble with the phrasing. It works if I lazily combine the two strings but cant seem to get it to work using an 'or' statement to compare both strings against the string elements within (i). https://code.sololearn.com/ctP5iZ84x6aO/?ref=app

15th Mar 2020, 2:15 PM
ren[paused]
ren[paused] - avatar
5 odpowiedzi
+ 3
ren What is especifically your question. Cause in your code, you should use a word reverse (I don't know it's name) and a string "cleaner"... So what's your question?
15th Mar 2020, 2:55 PM
Edu Ramos
Edu Ramos - avatar
+ 2
You need use and not or. [ In that way] Edit: If you use or, then not in punctuation comes true and 'not in digit' not calculated..... Edit: ren print(''.join([i for i in encoded[::-1] if i not in d and i not in p]))
15th Mar 2020, 2:56 PM
Jayakrishna 🇮🇳
0
Guess I got some reading to do :)
15th Mar 2020, 3:36 PM
ren[paused]
ren[paused] - avatar
0
My question was just on different ways if and or can be used to achieve certain effects. I was trying to make a loose clause where the item could be in string(x) or string(y). Didnt consider use of and
15th Mar 2020, 3:38 PM
ren[paused]
ren[paused] - avatar
0
First impression for me is to use or since if it's in either than pass through it didnt require it to be in both
15th Mar 2020, 9:16 PM
ren[paused]
ren[paused] - avatar