Skip to content

pariisaakhanjani/PythonPractices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

These are my list of exercises

  1. Write a Python program to sum up all the items in a list.✅

  2. Write a Python program to get the smallest number from a list.✅

  3. Write a Python program to count the number of strings from a given list of strings. The string length is 2 or more and the first and last characters are the same. (search isdigit) Sample List : ['abc', 'xyz', 'aba', '1221'] Expected Result : 2✅

  4. Write a Python program to remove duplicates from a list.✅

  5. Write a Python program to clone or copy a list.✅

  6. Write a Python program to find the list of words that are longer than n from a given list of words.

  7. Write a Python program to convert a list of characters into a string.

  8. Write a Python program to find the index of an item in a specified list.

  9. Write a Python program to append a list to the second list.

  10. Write a Python program to find the second smallest number in a list.

  11. Write a Python program to convert a list of multiple integers into a single integer. Sample list: [11, 33, 50] Expected Output: 113350

  12. Write a Python program to extend a list without appending. Sample data: [10, 20, 30] [40, 50, 60] Expected output : [40, 50, 60, 10, 20, 30]

  13. Write a Python program to find items starting with a specific character from a list. Expected Output: Original list: ['abcd', 'abc', 'bcd', 'bkie', 'cder', 'cdsw', 'sdfsd', 'dagfa', 'acjd'] Items start with a from the said list: ['abcd', 'abc', 'acjd'] Items start with d from the said list: ['dagfa'] Items start with w from the said list: []

  14. Write a Python program to flatten a given nested list structure. Original list: [0, 10, [20, 30], 40, 50, [60, 70, 80], [90, 100, 110, 120]] Flatten list: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]

  15. Write a Python program to split a given list into two parts where the length of the first part of the list is given. Original list: [1, 1, 2, 3, 4, 4, 5, 1] Length of the first part of the list: 3 Splited the said list into two parts: ([1, 1, 2], [3, 4, 4, 5, 1])

  16. Write a Python program to split a given list into specified-sized chunks. Original list: [12, 45, 23, 67, 78, 90, 45, 32, 100, 76, 38, 62, 73, 29, 83] Split the said list into equal size 3 [[12, 45, 23], [67, 78, 90], [45, 32, 100], [76, 38, 62], [73, 29, 83]] Split the said list into equal size 4 [[12, 45, 23, 67], [78, 90, 45, 32], [100, 76, 38, 62], [73, 29, 83]] Split the said list into equal size 5 [[12, 45, 23, 67, 78], [90, 45, 32, 100, 76], [38, 62, 73, 29, 83]]

  17. Write a Python program to join two given list of lists of the same length, element wise. Original lists: [[10, 20], [30, 40], [50, 60], [30, 20, 80]] [[61], [12, 14, 15], [12, 13, 19, 20], [12]] Join the said two lists element wise: [[10, 20, 61], [30, 40, 12, 14, 15], [50, 60, 12, 13, 19, 20], [30, 20, 80, 12]] Original lists: [['a', 'b'], ['b', 'c', 'd'], ['e', 'f']] [['p', 'q'], ['p', 's', 't'], ['u', 'v', 'w']] Join the said two lists element wise: [['a', 'b', 'p', 'q'], ['b', 'c', 'd', 'p', 's', 't'], ['e', 'f', 'u', 'v', 'w']]

  18. Given a list of numbers. write a program to turn every item of a list into its square.

  19. Concatenate two lists in the following order : list1 = ["Hello ", "take "] list2 = ["Dear", "Sir"]

['Hello Dear', 'Hello Sir', 'take Dear', 'take Sir']

  1. Python program to interchange first and last elements in a list

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages