-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex18.py
More file actions
executable file
·35 lines (28 loc) · 956 Bytes
/
ex18.py
File metadata and controls
executable file
·35 lines (28 loc) · 956 Bytes
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
#!/usr/bin/env python
""" Names, Variables, Code, Functions """
from __future__ import print_function, division
def main():
""" Main routine """
print_two("Zed", "Shaw")
print_two_again("Zed", "Shaw")
print_one("First!")
print_none()
# this one is like your scripts with argv
def print_two(*args):
""" this one is like your scripts with argv """
arg1, arg2 = args
print("arg1: {!r}, arg2: {!r}".format(arg1, arg2))
# ok, that *args is actually pointless, we can just do this
def print_two_again(arg1, arg2):
""" ok, that *args is actually pointless, we can just do this """
print("arg1: {!r}, arg2: {!r}".format(arg1, arg2))
# this just takes one argument
def print_one(arg1):
""" this just takes one argument """
print("arg1: {!r}".format(arg1))
# this one takes no arguments
def print_none():
""" this one takes no arguments """
print("I got nothin'.")
if __name__ == "__main__":
main()