KEMBAR78
SACP Assignment 2 | PDF
0% found this document useful (0 votes)
15 views1 page

SACP Assignment 2

The document outlines a series of programming tasks, including operations on lists, sorting algorithms, binary search, date formatting, binary to decimal conversion, string comparisons, and string manipulation functions. It also requests explanations of specific dictionary methods and concepts like nested dictionaries and frozen sets. Each task requires the implementation of Python code to demonstrate the specified functionality.

Uploaded by

Aravind
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
15 views1 page

SACP Assignment 2

The document outlines a series of programming tasks, including operations on lists, sorting algorithms, binary search, date formatting, binary to decimal conversion, string comparisons, and string manipulation functions. It also requests explanations of specific dictionary methods and concepts like nested dictionaries and frozen sets. Each task requires the implementation of Python code to demonstrate the specified functionality.

Uploaded by

Aravind
Copyright
© © All Rights Reserved
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/ 1

SACP Assignment-2

1. Make a list of the first eight letters of the alphabet, then using the slice operation do the
following operations:
a. Print the first three letters of the alphabet.
b. Print any three letters from the middle.
c. Print the letters from any particular index to the end of the list
2. Write a program to sort the elements in ascending order using selection sort.
3. Write a program to sort the elements in ascending order using insertion sort.
4. Write a Python program to use binary search to find the key element in the list.
5. Write a program that reads the date in the format (dd/mm/yyyy) and replaces the ‘/’ with
a ‘-’ and displays the date in (dd-mm-yyyy) format.
6. Write a program that parses a binary number to a decimal integer. For example, 11001
(1 * 24 + 1 * 23 + 0 * 22 + 0 * 21 + 1 * 20 ).
7. Consider the following four string variables, as shown:
city1 = "London"
city2 = "Paris"
city3 = "London"
city4 = "Sydney"
What are the results of the following expressions?
a. city1 == city2
b. city3.count('n')
c. city1 <= city4
d. city2.upper()
e. len(city4)
f. city1.lower()
8. Write a function to insert a string in the middle of the string.
9. Write short notes on the following methods. a. keys() b. values() c. get(key) d. clear()
10. Explain nested dictionaries with an example.
11. Define frozen set with examples

You might also like