Ankit Kumar Sisodia

Tuple in Python

1. What is a Tuple? A tuple is a collection of items. It stores multiple values in a single variable. Tuples are ordered and immutable (cannot be changed). Example Output: 2. Features of Tuple Ordered Immutable (cannot modify items) Allows duplicate values Can store different data types Faster than lists 3. Creating a Tuple Multiple…

Read More

String in Python

What is a String? A string is a sequence of characters enclosed in: Single quotes ‘ ‘ Double quotes ” ” Triple quotes ”’ ”’ or “”” “”” Example Features of Strings Strings are immutable (cannot be changed after creation) Strings are indexed. 3. String Indexing Positive Indexing As we have seen that list items…

Read More