0% found this document useful (0 votes)
7 views

Python Practice Questions

Set of python questions to practice

Uploaded by

Ankur Mahour
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Python Practice Questions

Set of python questions to practice

Uploaded by

Ankur Mahour
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Practice set 2

1. Write a Python function that takes a list of integers as input and returns the sum of all
the elements in the list
2. Write a Python function that takes a list of integers and returns the largest element in
the list.
3. Write a Python function that takes a list and an element, and returns the number of
times the element appears in the list.
4. Write a Python function that takes a list and returns the list in reverse order without
using the built-in reverse() method.
5. Write a Python function that takes a list and removes all duplicate elements, returning
a list with only unique elements.
6. Write a Python function that sorts a list of integers in ascending order without using
the sort() method.
7. Write a Python function that checks if a given list is a palindrome (i.e., it reads the
same forward and backward).
8. Write a Python function that merges two lists, element-wise, into a list of tuples. If the
lists are of different lengths, stop when the shorter list ends.
9. Write a Python function that rotates the elements of a list by n positions to the right.
For example, rotating [1, 2, 3, 4, 5] by 2 positions gives [4, 5, 1, 2, 3].
10. Write a Python function that returns the second largest element in a list of integers.

You might also like