Professional Documents
Culture Documents
Output :
MRO:
import pickle
class employee:
def __init__(self,id=0,name="a",salary=0):
self.dic1={}
self.dic1["id"]= id
self.dic1["Name"]= name
self.dic1["Salary"]= salary
outfile = open("battle.txt","wb")
pickle.dump(self.dic1,outfile)
outfile.close()
def display(self):
infile=open("battle.txt","rb")
dic2=pickle.load(infile)
infile.close()
print("ID:{}\nName:{}\nSalary:{}".format(dic2["id"],dic2["Name"],dic2["Salary"]))
n=input("Enter ID,name and salary").split()
ob=employee(int(n[0]),n[1],n[2])
import collections
DoubleEnded = collections.deque(["Mon","Tue","Wed"])
print (DoubleEnded)
DoubleEnded.append("Thu")
print (DoubleEnded)
DoubleEnded.appendleft("Sun")
print (DoubleEnded)
DoubleEnded.pop()
print (DoubleEnded)
DoubleEnded.popleft()
print (DoubleEnded)
DoubleEnded.reverse()
print (DoubleEnded)
Output:
Client:
import socket
def client_program():
host = socket.gethostname()
port = 5000
client_socket = socket.socket()
client_socket.connect((host, port))
message = input("bot-> ")
while message.lower().strip() != 'bye':
client_socket.send(message.encode())
data = client_socket.recv(1024).decode()
print('Received from server(Sanket): ' + data)
message = input("bot-> ")
client_socket.close()
if __name__ == '__main__':
client_program()
Output:
Client
Server :
scripts. Some of the popular language. Due to its rich library and
support, it has wide applications in
projects in Perl are CPanel and
Web Development, Machine
Bugzilla. It was initially designed
Learning, Desktop Applications,
to replace complex shell scripts.
etc.
Python.
The .pl file extension is used to The .py file extension is used to
File Extension save Perl Scripts. For example save Python Scripts. Example:
myDocument.pl myFile.py
End of All statements should end with statements with a semi colon in
whitespaces.
Comments and For Inline comments, we use # Python also uses # for Inline
starts from here and ends here. starts from here and ends here.”””
=cut
Statement Perl uses braces to mark the Python use indentations to mark
Datatypes Perl are numeric, string, Scalars, Python are numeric, strings, lists,