-
Notifications
You must be signed in to change notification settings - Fork 138
Expand file tree
/
Copy pathD_functions_parrot.py
More file actions
46 lines (39 loc) · 1.28 KB
/
D_functions_parrot.py
File metadata and controls
46 lines (39 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
"""Does...
Created on Aug 25, 2011
@author: paulross
"""
__author__ = 'Paul Ross'
__date__ = '2011-08-03'
__version__ = '0.1.0'
__rights__ = 'Copyright (c) 2011 Paul Ross.'
###################################
# The many ways of calling parrot()
###################################
def parrot(voltage,
state='a stiff',
action='voom',
type='Norwegian Blue'):
print("-- This parrot wouldn't", action)
print("if you put", voltage, "volts through it.")
print("-- Lovely plumage, the", type)
print("-- It's", state, "!")
def main():
parrot(1000)
print("\n")
parrot(action='VOOOOOM', voltage=1000000)
print("\n")
parrot('a thousand', state='pushing up the daisies')
print("\n")
parrot('a million', 'bereft of life', 'jump')
print("\n")
# These will raise a SyntaxError
# parrot() # required argument missing
# parrot(voltage=5.0, 'dead') # non-keyword argument following keyword
parrot(110, 'a', 'b', voltage=220) # duplicate value for argument
# parrot(actor='John Cleese') # unknown keyword
if __name__ == '__main__':
main()
########################################
# END: The many ways of calling parrot()
########################################