Savitribai Phule Pune University T.Y.B.B.A.(C.A.) Python Practical Slip 20 Answers

   Write a Python program

Slip 20 A) Write a python program to create a class Circle and Compute the Area and the circumferences of the circle.(use parameterized constructor)

Answer :

class Circle():

    def init (self, r):

        self.radius = r

 

    def area(self):

        return self.radius**2*3.14

       

    def perimeter(self):

        return 2*self.radius*3.14

 

NewCircle = Circle()

NewCircle.init(8)

print(NewCircle.area())

print(NewCircle.perimeter())

Output :


Write a Python script to generate and print a dictionary which contains a number (between 1 and n) in the form(x,x*x). Sample Dictionary (n=5) Expected Output: {1:1, 2:4, 3:9, 4:16, 5:25}

Slip 20 B) Write a Python script to generate and print a dictionary which contains a number (between 1 and n) in the form(x,x*x). Sample Dictionary (n=5) Expected Output: {1:1, 2:4, 3:9, 4:16, 5:25}

Answer :

dict={}

n=5

for x in range(1,n+1):

    dict[x]=x*x

print(dict)

Output :


Write a python program to create a class Circle and Compute the Area and the circumferences of the circle.(use parameterized constructor)
Savitribai Phule Pune University T.Y.B.B.A.(C.A.) Python Practical Slip 20 Answers Savitribai Phule Pune University T.Y.B.B.A.(C.A.) Python Practical Slip 20 Answers Reviewed by technical_saurabh on December 31, 2021 Rating: 5

2 comments:

Sample Assignment said...

We are Australia's top academic support experts, and we have assisted countless students in completing their programming assignments on time. You'll be relieved to know that the strain of completing your assignments will be lifted with our assistance. Get in touch with our team for Programming Assignment Help

Assignment Help Online said...

Looking for high-qualitySample Assignment UK ? Explore our wide range of academic samples to enhance your understanding and excel in your studies

Powered by Blogger.