0% found this document useful (0 votes)
4 views2 pages

Assmt Quest

The document outlines various programming tasks in Python, including calendar display, date calculations, and string manipulations. It also includes examples of set operations, dictionary grouping, and frequency counting of elements. Each task is designed to enhance programming skills in handling data structures and algorithms.

Uploaded by

tonybaskar83
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)
4 views2 pages

Assmt Quest

The document outlines various programming tasks in Python, including calendar display, date calculations, and string manipulations. It also includes examples of set operations, dictionary grouping, and frequency counting of elements. Each task is designed to enhance programming skills in handling data structures and algorithms.

Uploaded by

tonybaskar83
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
You are on page 1/ 2

1. To Show Calendar for the given year and month.

2. To calculate number of days or age between any two given dates.


3. Create a list myfriend with any 8 of your friends name. Write the program to show the
names using for statement.
4. To find maximum and minimum element in a tuple.
5. Using lambda function to get any integer value and show all the factors of the given number
6. To create a python program to get n input value and show the following: (Example: n=4)
*
* *
* * *
* * * *
7. To find the sum of digits of a given number using function
8. To count the number of vowels, consonants, digits and special character from the given string
9. To reverse a given string using function.
10. To find GCD of two numbers
11. To perform matrix addition, subtraction, multiplication using looping statement
12. To generate Fibonacci series using recursion
13. To find the element and its position in a list and to display it.
14. Sum of n natural numbers using recursion
15. To find factorial of a number using function or looping statement
16. To generate prime numbers .
17.

Set- program

friends_A = {"Alice", "Bob", "Charlie"}

friends_B = {"Bob", "David", "Eve"}

common_friends = friends_A.intersection(friends_B)

print(common_friends) # Output: {'Bob'}

Dictionary program

data = [

{'name': 'Alice', 'department': 'HR'},

{'name': 'Bob', 'department': 'IT'},


{'name': 'Charlie', 'department': 'HR'},

{'name': 'David', 'department': 'IT'}

grouped = {}

for item in data:

department = item['department']

if department not in grouped:

grouped[department] = []

grouped[department].append(item['name'])

# Output: {'HR': ['Alice', 'Charlie'], 'IT': ['Bob', 'David']}

Frequency of elements

elements = ['apple', 'banana', 'apple', 'orange', 'banana', 'apple']

frequency = {}

for item in elements:

frequency[item] = frequency.get(item, 0) + 1

# Output: {'apple': 3, 'banana': 2, 'orange': 1}

You might also like