Dead Parrot - Python in Python
Tags: referendumPythonEUhumour08 Jan 2017 - MawKernewek
Giant dead parrot found in UK. Species 'Psitticus Brexitus'. Scientists insist it's dead & won't fly. Gvmt say "the people" demand it flies. pic.twitter.com/AH5Twgwjvo— Scientists for EU (@Scientists4EU) 8 January 2017
For more EU referendum humour see my previous posts:
# -*- coding: utf-8 -*-
import sys, time
import imp
imp.reload(sys)
if sys.version_info[0] < 3:
sys.setdefaultencoding('utf-8')
class Parrot:
def __init__(self, name):
"""
initialise Parrot object
"""
print("Initialising parrot")
self.latin = "psitticus"
self.name = name
self.isalive = True
self.latin = self.latin + " {n}".format(n=name.lower()+"us")
def dispatch(self):
print("dispatching parrot")
self.isalive = False
def printName(self):
print("This parrot's name is {n}.".format(n=self.name))
print("Latin: {l}".format(l=self.latin))
def checkAlive(self):
if self.isalive:
print("This parrot is healthy.")
else:
print("This is an ex-parrot, it has ceased to be.")
if __name__ == "__main__":
if sys.version_info[0] < 3:
pname = raw_input("What is the parrot's name? ")
else:
pname = input("What is the parrot's name? ")
parrot = Parrot(pname)
parrot.printName()
parrot.checkAlive()
time.sleep(3)
parrot.dispatch()
time.sleep(1)
parrot.checkAlive()
Gul Dukat wins galactic presidential election and
Federation Membership referendum.