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

   Write a Python program

Slip 14 A) Write a Python GUI program to accept dimensions of a cylinder and display the surface area and volume of cylinder.

Answer :


pi=22/7

 

height = float(input('Height of cylinder: ')) radian = float(input('Radius of cylinder: ')) volume = pi * radian * radian * height

sur_area = ((2*pi*radian) * height) + ((pi*radian**2)*2) print("Volume is: ", volume)

print("Surface Area is: ", sur_area)


Output :

 

Slip 14 B) Write a Python program to display plain text and cipher text using a Caesar encryption.

Answer :


def encrypt(text,s):

result = ""

for i in range(len(text)):

char = text[i]

if (char.isupper()):

    result += chr((ord(char) + s-65) % 26 + 65) else:

    result += chr((ord(char) + s - 97) % 26 + 97) return result

text = "CEASER CIPHER DEMO"

s = 4    

print "Plain Text : " + text print "Shift pattern : " + str(s)

print "Cipher: " + encrypt(text,s)


Output :

Savitribai Phule Pune University T.Y.B.B.A.(C.A.) Python Practical Slip 14 Answers Savitribai Phule Pune University T.Y.B.B.A.(C.A.) Python Practical Slip 14 Answers Reviewed by technical_saurabh on December 31, 2021 Rating: 5

No comments:

Powered by Blogger.