| Sr.No | Assignment name |
|---|---|
| Set-A | |
| 1 |
Write a Python program to find maximum and the
minimum value in a set.
|
| 2 |
Write a Python program to add an item in a tuple. Plz Click on Question to see Answera=tuple() b=list() n=int(input("Enter limit")) for i in range(0,n): val=input("Enter values") b.append(val) a=tuple(b) print(a) |
| 3 |
Write a Python program to convert a tuple to a string. Plz Click on Question to see Answera=('b','b','a','c','a') print("Display tuple",a) s1=" " for ch in a: s1=s1+ch print("String=",s1) |
| 4 |
Write a Python program to create an intersection of sets. Plz Click on Question to see Answera=[10,20,30,40,50] print("List=",a) a.append(60) print("Push element in list=",a) val=a.pop() print("poped values=",val) print("After pop element in the list=",a) |
| 5 |
Write a Python program to create a union of sets. Plz Click on Question to see Answera={10,20,30} b={40,20,50} c={10,20,60} d=a.union(b,c) print("Union Value=",d) |
| 6 |
Write a Python script to check if a given key already exists in a dictionary. Plz Click on Question to see Answerdef checkKey(d,k): if k in d: print("Key is present") else: print("Key is not present") d={'a':10,'b':20,'c':30} k='b' checkKey(d,k) |
| 7 |
Write a Python script to sort (ascending and descending) a dictionary by value. Plz Click on Question to see Answera={"15":"om","21":"sai","14":"ram","35":"sham"} b=sorted(a.values()) print("Values Ascending Order=",b) b=sorted(a.values(),reverse=True) print("Values Descending Order=",b) |
| Set-B | |
| 1 |
Write a Python program to create set difference
and a symmetric difference.
|
| 2 |
Write a Python program to create a list of tuples with the first element as the number and second element as the square of the number. Plz Click on Question to see Answern=int(input("Enter limit")) a=[] for i in range(0,n): num=int(input("Enter number")) a.append((num,num*num)) print(a) |
| 3 |
Write a Python program to unpack a tuple in several variables. Plz Click on Question to see Answera=(10,20,30) print("Pack values=",a) x,y,z=a print("Value in X=",x) print("Value in Y=",y) print("Value in Z=",z)s=input("Enter String:") w=input("Enter word:") a=[] count=0 a=s.split(" ") for i in range(0,len(a)): if(w==a[i]): count=count+1 print("count of the word is:") print(count) |
| 4 |
Write a Python program to get the 4th element from frontand 4th element from last of a tuple. Plz Click on Question to see Answera=(11,22,33,44,55,66,77,88,99,35) print("Fourth Element=",a[3]) print("Fourth Element from Last=",a[-4]) |
| 5 |
Write a Python program to find the repeated items of a tuple. Plz Click on Question to see Answera=(10,20,30,40,10,20,20,30,50) d={} for val in a: if val in d: d[val]=d[val]+1 else: d[val]=1 for k in d: if d[k]!=1: print(k,"=",d[k]) |
| 6 |
Write a Python program to check whether an element exists Plz Click on Question to see Answera=(10,20,30,40,50) n=int(input("Enter No:")) if n in a: print("Element Exists") else: print("Element Not Exists") |
| 7 |
Write a Python script to concatenate following dictionaries to create a new one. Sample Dictionary : dic1={1:10, 2:20} dic2={3:30, 4:40} dic3={5:50,6:60} Expected Result:{1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60} Plz Click on Question to see Answerd1={"101":"om","102":"sai"} d2={"103":"ram","104":"sham"} d3={"105":"dada","106":"baba"} result=d1|d2|d3 print(result) |
| Set-C | |
| 1 |
Write a Python program to create a shallow copy of sets. Plz Click on Question to see Answera={10,20,30} b=a.copy() print("Original set=",a) print("Copy set=",b) a.add(55) print("After add Original set=",a) print("After add Copy set=",a.copy()) |
| 2 |
Write a Python program to combine two dictionary adding values for common keys. d1 = {'a': 100, 'b': 200, 'c':300} d2 = {'a': 300, 'b': 200, 'd':400} Sample output: Counter({'a':400,'b':400,'d': 400,'c': 300}) Plz Click on Question to see Answerd1={"a":100,"b":200,"c":300} d2={"a":300,"b":200,"c":400} d3=d1.copy() for k in d2: if k in d3: d3[k]=d3[k]+d2[k] else: d3[k]=d2[k] print(d3) |
- Home
- SYLLABUS
- _FYBBA(CA)
- __DBMS
- __WEB TECHNOLOGY
- _SYBBA(CA)
- __PHP
- __ADVANCE PHP
- _TYBBA(CA)
- __CORE JAVA
- __ADVANCE JAVA
- NOTES
- _Database System
- __CHAPTER1
- __CHAPTER 2
- _Web Technology
- __Chapter-1
- __Chapter-2
- __Chapter-3
- _Advance PHP
- __Chapter-1
- __Chapter-2
- __Chapter-3
- Research
- About us
- Assignment
- certificate
- Solved Programs
- Problem
- _Lab Book
- _Practical Slips
- _Assignment Submit
- _Project Guideline
- __SYBBACA SEM-IV
- __TYBBACA SEM-V
- __TYBBACA SEM-VI
- _C language
- __Simple Program
- __Simple Program
0 Comments