Python Programming Tutorial – 38 – Unpack List or Tuples

Related Posts

10 thoughts on “Python Programming Tutorial – 38 – Unpack List or Tuples

  1. hey guys I realized that the asterisk (*) can move around to the first variable or even the last variable.

    e.g. first, second, *rest = <list>
    *beg, second_last, last = <list>

    pretty cool observation, eh?

  2. Note: We can also use def drop_first_last(*grades) and pass in a variable number of arguments, such as drop_first_last(10,5,10,3), instead of a list. We learned this in a previous video and it does the same thing.

  3. Hello
    thank you for the course.please how to calculate the number of tags in an HTML,like (<head>,</head>,<html>,</html>,<body>,</body>….etc)
    thanks

  4. Simple question: Why can't we do this:
    def drop_fist_last(marks):
    marks = first, *middle, last
    ave_marks = sum(marks)/ len(marks)
    print(ave_marks)
    pass
    drop_fist_last([94, 34, 32, 44, 22, 99])
    drop_fist_last([94, 34, 32, 44, 22, 99, 88, 44, 22])

Leave a Reply