PYTHON Study Guide - Midterm Guide: Tuple

2 views3 pages
25 May 2023
Department
Course
Professor

Document Summary

#6 python tutorial for beginners | tuple | set in. In the last paper, we talked about lists and we were supposed to complete tuples and sets, but due to time constraints, we will complete them in this paper. A tuple is similar to a list, but it is immutable, which means you cannot change the value of a tuple. You can create a tuple by using round brackets and specifying the values inside them. Here is an example: tup = (21, 6, 14, 25) Once you specify the values in a tuple, you cannot change them. You can fetch values using square brackets, but you cannot change them. Tuples are useful in projects where you do not want to change the values of a list. Iteration in tuples is faster than in lists, so if you want to enhance the speed of your execution, you can use tuples. A set is a collection of unique elements.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers

Related Documents

Related Questions