Update README.md

Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
David Rotermund 2023-12-06 23:36:11 +01:00 committed by GitHub
parent dce41a44e2
commit 95e94c3353
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,3 +35,32 @@ if_stmt ::= "if" assignment_expression ":" suite
["else" ":" suite]
```
## if, elif, else with lists
```python
A = 1
if A in [0, 2, 4, 6, 8]:
print("found")
else:
print("NOT found")
```
Output
```python
NOT found
```
```python
A = 2
if A in [0, 2, 4, 6, 8]:
print("found")
else:
print("NOT found")
```
Output
```python
found
```