Operation | Description |

x in s | True if element x is in sequence s. |

x not in s | True if element x is not in sequence s. |

s1 + s2 | Concatenates two sequences s1 and s2. |

s * n, n * s | n copies of sequence s concatenated. |

s[i] | ith element in sequence s. |

s[i : j] | Slice of sequence s from index i to j – 1. |

len(s) | Length of sequence s, i.e., the number of elements in s. |

min(s) | Smallest element in sequence s. |

max(s) | Largest element in sequence s. |

sum(s) | Sum of all numbers in sequence s. |

for loop | Traverses elements from left to right in a for loop. |

<, <=, >, >=, =, != | Compares two sequences.Compares two sequences. |

>>>list1 = [2, 3, 4, 1, 32] >>>len(list1) 5 >>>max(list1) 32 >>>min(list1) 1 >>>sum(list1) 42 >>> import random >>>random.shuffle(list1) # Shuffle the elements in list1 >>> list1 [4, 1, 2, 32, 3] >>>