I’m just learning python and working with lists and some loops. In terms of debugging my code I was trying to figure out what list item would be present and to return it. The code is checking each letter in the string and will output that letter if it is in the list. I know this can be done in other ways.
Code is below:
String = ‘test’ List = [‘1’, ‘a’, ‘e’] For Letter in string: If Letter in list: Print(list)
In this case I want to print the letter e, I get an error if put list and the full list as the code is.
My intention is not to actually print this but for debugging only to see the value. The actual code will simply continue if character exists. Is this possible to do?