انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

Lec 8-PL-Python-Tuple

Share |
الكلية كلية تكنولوجيا المعلومات     القسم قسم شبكات المعلومات     المرحلة 1
أستاذ المادة رائد نصر كاظم العبيدي       03/05/2019 18:18:19
1. Introduction

Lists aren’t the only kind of ordered sequence in Python. The last collection ordered type in Python tuple. Tuples construct simple groups of elements. They work exactly like lists, except that tuples can’t be changed in place (they’re immutable). This seems to be the first question that always comes up when teaching beginners about tuples: why do we need tuples if we have listed? The best answer, however, seems to be that the immutability of tuples provides some integrity—you can be sure a tuple won’t be changed through another reference elsewhere in a program, but there’s no such guarantee for lists. Tuples and other immutable, therefore, serve a similar role to “constant” declarations in other languages, though the notion of constantans is associated with objects in Python, not variables. Tuples can also be used in places that list can not—for example, as dictionary keys. Some built-in operations may also require or imply tuples instead of lists (e.g., the substitution values in a string format expression).


المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم