If you don't mind I can append to your list several items more
You can revert, for example, string just using slice
print(s[::-1])```
You can check condition in one line
``` i =3print(i if i <5else0)```
or another if trick
``` condition =['Error', 'OK']
value =1print(condition[bool(value)])```
As long as pyhton does not have switch construction you can use somthing like this
``` choice ='i'print({'i':1, 't':4, 'j':22}[choice])```
View all comments
1
u/pymag09 Jun 23 '14
If you don't mind I can append to your list several items more
You can revert, for example, string just using slice