+ 1
How and when do you use the colom?
5 Answers
+ 14
and don't forget the walrus operator :=
+ 9
colon is used with ->
if...:
...
elif...:
...
else:
...
----
try...:
...
except...:
...
----
while ...:
----
for ...:
----
def my_func(...): (defining user functions)
...
----
class Coordinates(): (defining a class)
...
----
After each colon, next line has to be indented, except the following case ->
----
Colon is also used with slices ->
inp[3:10]
----
creating dictionary to separate key : values
+ 5
Conditions, loops, dictionaries, some arguments require them too
+ 4
Oh and don't forget Lambdas đ
+ 4
Collecting things in common is called swarm intelligence. đđđ€Ł