mirror of
https://github.com/Fechin/reference.git
synced 2026-11-20 21:23:11 +03:00
Update python.md with python operators and walrus
This commit is contained in:
1 parent
0f655ba0bf
commit
3c28b1eef9
1 file changed
+17
@@ -1483,6 +1483,23 @@ resp = dict(code=0, message="OK", data=[])
|
||||
successed: bool = converter(resp["message"], mapper=is_success, default=False)
|
||||
```
|
||||
|
||||
## Python Operators
|
||||
|
||||
### Walrus {.col-span-2}
|
||||
|
||||
```python
|
||||
values = [1, "text", True, "", 2]
|
||||
i = 0
|
||||
|
||||
# It assigns a value to a variable and compares it in a boolean expression
|
||||
while (data := values[i]):
|
||||
|
||||
print(data, end=",")
|
||||
i = i + 1
|
||||
|
||||
# Expected result: 1, "text", True
|
||||
```
|
||||
|
||||
## Miscellaneous
|
||||
|
||||
### Comments
|
||||
|
||||
Reference in new issue
Block a user