+ 1

* symbol use and meaning in python

For a given question below: a, b, c, d,*e= range (20) Hence a=0 b=1 c=2 d=3 e=14 Now I know that *e is calculated as (20-a-b-c-d) I wanted to know why? And what is *e known as in python is it a normal variable, a pointer or something else?

21st Jan 2022, 5:22 PM
Huzefa Sadikot
Huzefa Sadikot - avatar
1 Respuesta
+ 1
In that context, * is being used as a packing operator. It is known as an unpacking operator, too. Also ** is a packing/unpacking operator that is used for dictionaries. Here is a pretty good tutorial on the packing/unpacking operators: https://geekflare.com/JUMP_LINK__&&__python__&&__JUMP_LINK-unpacking-operators/
21st Jan 2022, 7:53 PM
Brian
Brian - avatar