| Sr.No | Assignment name |
|---|---|
| Set-A | |
| 1 |
Write a recursive function which print string in reverse order.
|
| 2 |
Write a python script using function to calculate x^y Plz Click on Question to see Answerimport math base_number=float(input("Enter the base number")) exponent=float(input("Enter the exponent")) power=math.pow(base_number,exponent) print("Power is =",power) |
| 3 |
Define a function that accept two strings as input and find union and intersection of them. Plz Click on Question to see Answerstr1=input("enter first string:") str2=input("enter second string:") res=set(str1).union(str2) print(f"union of {str1} & {str2} is=",str(res)) res2=set(str1).intersection(str2) print(f"intersection of {str1} & {str2} is=",str(res2)) |
| 4 |
Write a recursive function to calculate sum of digits of a given input number Code. Plz Click on Question to see Answerdef sumofd(n): if n==0: return 0 else: return n%10+sumofd(n//10) num=int(input("enter number to calculate sum of digits=")) print("sum of digits=",sumofd(num)) |
| 5 |
Write generator function which genrate even numbers up to n Code: Plz Click on Question to see Answerdef evennum(s): b=1 while b<=s: yield b*2 b+=1 for i in evennum(20): print(i) |
| Set-B | |
| 1 |
Write a python script to generate Fibonacci terms using generator function Code.
|
| 2 |
Write a python script using package to calculate area and volume of cylinder and cuboids. Plz Click on Question to see AnswerFile Name:-Cuboid.py def cuboid(l,w,h): area=2*(l*w+l*h+w*h) print("surface area of cuboid=",area) volume=l*w*h print("volume of cuboid=",volume) cuboid(2,3,4) File Name:-cylinder.py def cylinder(r,h): area=((2*3.14*r)*h)+((3.14*r**2)*2) print("surface area of cylinder=",area) volume=3.14*r*r*h print("volume of cylinder=",volume) cylinder(2,3) File Name:- package __init__.py from cuboid import cuboid from cylinder import cylinder package.py import mypack print(mypack.cylinder(2,4)) |
| 3 |
Write a python script to accept decimal number and convert it to binary and octal number using function. Plz Click on Question to see Answerdec = int(input("Enter the number")) print("The decimal value of", dec, "is:") print(bin(dec), "in binary.") print(oct(dec), "in octal.") |
| 4 |
Write a function which print a dictionary where the keys are numbers between 1 to 20. Plz Click on Question to see Answerd=dict() for x in range(1,2 1): d[x]='' print(d) |
| 5 |
Write a generator function which generates prime numbers up to n. Plz Click on Question to see Answerdef prime_generator(end): for n in range(2, end): for x in range(2, n): if n % x == 0: break else: yield n g = prime_generator(100) print(list(g)) |
| Set-C | |
| 1 |
Write a progrm to illustrate function duck typing Plz Click on Question to see Answerclass python: def execute(self): print('Compiling') print('Running') print('Spell Check') print('Convention Check') class script: def code(self, ide): ide.execute() ide = python() desk = script() desk.code(ide) |
- 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