FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
learn-python3/samples/function/kw_args.py at master · sofay/learn-python3 · GitHub
sofay
/
learn-python3
Public
forked from
michaelliao/learn-python3
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
learn-python3
/
samples
/
function
/
kw_args.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
31 lines (25 loc) · 709 Bytes
Breadcrumbs
learn-python3
/
samples
/
function
/
kw_args.py
Copy path
File metadata and controls
executable file
·
31 lines (25 loc) · 709 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def
print_scores
(
**
kw
):
print
(
' Name Score'
)
print
(
'------------------'
)
for
name
,
score
in
kw
.
items
():
print
(
'%10s %d'
%
(
name
,
score
))
print
()
print_scores
(
Adam
=
99
,
Lisa
=
88
,
Bart
=
77
)
data
=
{
'Adam Lee'
:
99
,
'Lisa S'
:
88
,
'F.Bart'
:
77
}
print_scores
(
**
data
)
def
print_info
(
name
,
*
,
gender
,
city
=
'Beijing'
,
age
):
print
(
'Personal Info'
)
print
(
'---------------'
)
print
(
' Name: %s'
%
name
)
print
(
' Gender: %s'
%
gender
)
print
(
' City: %s'
%
city
)
print
(
' Age: %s'
%
age
)
print
()
print_info
(
'Bob'
,
gender
=
'male'
,
age
=
20
)
print_info
(
'Lisa'
,
gender
=
'female'
,
city
=
'Shanghai'
,
age
=
18
)
Back
|
FazBrowse Home
|
New Git URL