The document outlines various programming tasks related to string and list manipulation, including accessing characters, comparing lengths, and counting occurrences. It also covers operations like retrieving specific characters, sorting strings, and checking for the largest number in a list. Additionally, it includes methods for splitting strings, reversing them, and performing arithmetic operations on list elements.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
29 views8 pages
Midsem Revision
The document outlines various programming tasks related to string and list manipulation, including accessing characters, comparing lengths, and counting occurrences. It also covers operations like retrieving specific characters, sorting strings, and checking for the largest number in a list. Additionally, it includes methods for splitting strings, reversing them, and performing arithmetic operations on list elements.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8
Things to Recall
How to access a word - character by character?
How to compare the lengths of two strings? How to compare two adjacent characters in a given string? How to retrieve only alphabets in a given string? Access elements in a list Adding elements to the existing list Return a list in a function Count the occurrence of a given number in a list Count the occurrence of each element in a list Check if the given number is the largest in a given list? Check if the given number is the largest in a given range. Eg. Between position i and j Find the largest number in a given list? Fetch only the capital letters from the given string and store it in a separate list. Assume that a string is stored in a list. Sort the given string in: • Alphabetical order • Increasing order Check the presence of a character in a string Count the occurrence of a given character in a string without using count() function. Split the given string into two equal halves Odd length string Even length string Split the given string into two strings based on position Compare two strings Reverse a given string – [::-1] Count the number of words in a given string – Hint: words=s.split() Find the sum of the elements in a given list Check if the element is even/odd in a given list Check if it is a positive element in a list Return a tuple – return (a,b)