Hello, guys! I’m new to Python, and I have a problem. I’m trying to write a program, and for my program, I want to use a list to store data that I can access when I need it. So I’m trying to create an if statement to check if what I entered in the previous input matches any item in the list. However, it’s never matching. How can I fix that?
When presenting code (and output), paste it into the message between triple ticks like:
```
print(a)
```
rather than using screenshots.
As to your problem, to check whether a value is found in a list, you need to use the in
keyword like:
if sel_num in list_of_reg_num:
...
else:
...
1 Like
It’s really work, thank you!