MUST-STUDY PYTHON PROGRAMS
TOPIC: LIST
[Link] a program to find the length of a list
[Link] a program to create a user-defined list
[Link] a program that checks if a given number is present
(i)use membership operator (in)
(ii) use for loop ---if conditions
4. Write a Python program to count the occurrences of a particular number
5. Given a list of integers, write a program to multiply by 2 for every odd number and
add 1 to every even number in the list.
Input :[1,4,5,6]
Output:[2,5,10,7]
6. Write a program to traverse the given list
S=[20,30,1,9]
(a) using while loop
(b) using for loop with indexing
(c) using slicing
7. Write a program that takes any two lists L and M of the same size and adds their
elements together to form a new list N whose elements are the sums of the
corresponding elements in L and M. For instance, if L = [3, 1, 4] and M = [1, 5, 9],
then N should equal [4,6,13].
8. Write a program to create a list and perform the following functions:
Index, count, pop, remove, reverse, sort, sorted,min, max,sum
9. Write a program to create a list and
(i) print all even numbers
(ii) sum of all even numbers
(iii) Prints all the numbers from the list that end with the digit 5.
10. Write a program to accept a list of integers and print the square of each number
TOPIC: STRING
[Link] a Python program to count the occurrences of a particular word in a string
2. Write a Python program to count the occurrences of words that start with the letter
“s” in a given sentence.
[Link] a Python program to count the length of a string without using len function
[Link] a program to display all the words and the length of each word in a
sentence
[Link] a program to check a word is a palindrome
[Link] a program to count the number of digits in a string