In this we are going to see a basic program to demonstrate how to ignore values in Python Programming Language.
# ignoring a value
a, _, b = (1, 2, 3) # a = 1, b = 3
print(a, b)
# ignoring multiple values
# *(variable) used to assign multiple value to a variable as list while unpacking
# it's called "Extended Unpacking", only available in Python 3.x
a, *_, b = (7, 6, 5, 4, 3, 2, 1)
print(a, b)
#Code by Shrinivas
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP