RUVIDEO
Поделитесь видео 🙏

Python Tutorial for Beginners | Tuples in Python

This video will give you complete training in Tuples in Python Programming

Tuples
A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists. The main difference between the tuples and the lists is that the tuples cannot be changed, unlike lists. Tuples use parentheses whereas lists use square brackets.

Creating a tuple is as simple as putting different comma-separated values. Optionally, you can put these comma-separated values between parentheses. For eg,


The empty tuple is written as two parentheses containing nothing. tup1 = ();

To create a tuple containing a single value, we have to include a comma even though there is only one value.

tup1 = (50,)


Tuples as return values :

def swap(x, y):

return y, x


Functions can return tuples as return values. For example, we could write a function that swaps two parameters:

Then we can assign the return value to a tuple with two variables:

a, b = swap(a, b)


def swap(x, y):

x, y = y, x


In this case, there is no great advantage in making a swap a function. In fact, there is a danger in trying to encapsulate swap, which is the following tempting mistake:

If we call swap like this swap(a, b)



then a and x are aliases for the same value. Changing x inside swap makes x refer to a different value, but it has no effect on a in main. Similarly, changing y has no effect on b. This function runs without producing an error message, but it doesn’t do what we intended. This is an example of a semantic error.



Basic tuples operations, Concatenation, Repetition, in Operator, Iteration :

Tuples respond to the + and * operators much like strings; they mean concatenation and repetition here too, except that the result is a new tuple, not a string.



Python includes the following tuple functions-

Tuplelen()MethodDescription

The len() method returns the number of elements in the tuple.



Syntax

Following

is the syntax for len() method- len(tuple)



Parameters

tuple - This is a tuple from which max valued element to be returned.


Return Value

This method returns the elements from the tuple with maximum value

For Complete Course On Python Please visit: https://www.bestdotnettraining.com/python-online-training
___________________________________________________________________________________________
This video was compiled by Mr. Rahul Rampurkar, 22 years is a Sun Certified Java Programmer, Sun Certified Java Architect, and an AWS Certified Solutions Architect. His expertise includes Java, Java EE, XML and Web Services, Database technologies, and Cloud Computing with specialization in AWS.


Please subscribe to our channel for more related videos: https://www.youtube.com/user/Deccansoft123


For any course-related queries, reach us @ +91 8555823343 / +91 8008327000 Kashmira Shah
Please leave your comment about the videos.
For more updates on courses and tips follow us on:
- Facebook: https://www.facebook.com/DeccansoftHome
- Twitter: https://twitter.com/deccansoft
- LinkedIn: https://in.linkedin.com/company/deccansoft-software-services
- Website: https://www.deccansoft.com/ or https://www.bestdotnettraining.com/
- Join our WhatsApp group - https://chat.whatsapp.com/HzE43FXv0HJ2z5qGSPDren

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Python Tutorial for Beginners | Tuples in Python», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.