0% found this document useful (0 votes)
2 views30 pages

Computer Science Practice Programs

The document outlines a series of programming tasks related to lists, tuples, and dictionaries in Python. Each task includes a brief description followed by a placeholder for code and output. The tasks cover various operations such as summing elements, finding maximum and minimum values, counting occurrences, and manipulating data structures.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views30 pages

Computer Science Practice Programs

The document outlines a series of programming tasks related to lists, tuples, and dictionaries in Python. Each task includes a brief description followed by a placeholder for code and output. The tasks cover various operations such as summing elements, finding maximum and minimum values, counting occurrences, and manipulating data structures.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Q1. Create a list of N integers and display it.

Code:

Output:
[Link] the sum and average of elements of a list.

Code:

Output:
[Link] the largest and smallest element in the list.

Code:

Output:
[Link] even and odd numbers in a list

Code:

Output:
[Link] a list without using built in functions

Code:

Output:
[Link] an element in a list.

Code:

Output:
[Link] positive , negative , and zero elements in a list.

Code:

Output:
[Link] elements of one list to another list

Code:

Output:
Q9. Sort a list in ascending order.

Code:

Output:
[Link] duplicate elements from a list.

Code:

Output:
[Link] a tuple and display its elements using a loop

Code:

Output:
Q12 find the maximum and minimum element of a tuple

Code:

Output:
Q13 count the occurrence of an element in a tuple.

Code:

Output:
Q14 convert a list into tuple

Code:

Output:
Q15 check whether an element exists in a tuple

Code:

Output:
Q16 create a dictionary of student roll no. and marks

Code:

Output:
Q17 display keys values and items of a dictionary.

Code:

Output:
Q18 search a key in a dictionary.

Code:

Output:
Q19 find the sum of all values in a dictionary

Code:

Output:
Q20 count frequency of elements in a list using dictionary

Code:

Output:
Q21 create a dictionary of employee name and salary

Code:

Output:
Q22 update the value of key in a dictionary

Code:

Output:
Q23 print first N natural numbers using for loop

Code:

Output:
Q24 print factorial of a number using for loop

Code:

Output:
Q25 print multiplication table of a number

Code:

Output:
Q26 print even numbers between 1 to 50 using for loop

Code:

Output:

Q27 reverse a number using while loop


Code:

Output:

Q28 check whether a number is palindrome using while loop


Code:

Output:

Q29 find the sum of digits of a number using while loop


Code:

Output:

Q30 print Fibonacci series using while loop


Code:

Output:

You might also like