Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit02f3e5c

Browse files
committed
Add demo of multiple return values from function
1 parentf60fc7b commit02f3e5c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎FunctionIntroduction/src/findprime.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ def key_word_func_args(a, b, *args, **kargs):
5151
forkinkargs:
5252
print('key = {} and value = {}'.format(k,kargs[k]))
5353

54+
deffunc_return_multiple_val():
55+
print('Demo of returning multiple values in python')
56+
a=1
57+
b=2
58+
c=3
59+
d='This is a string'
60+
returna,b,c,d
61+
5462
defmain():
5563
forninrange(1,20):
5664
isprime(n)
@@ -65,5 +73,9 @@ def main():
6573
arbitrary_list_arg_func_2(1,2,3,4,5,6,7)
6674
print()
6775
key_word_func_args(3,45,1 ,2,3,one=1,two=2,three=3)
76+
print()
6877

78+
a,b,c,d=func_return_multiple_val()
79+
print('a={}, b = {}, c={}\nd={}'.format(a,b,c,d))
80+
6981
if__name__=='__main__':main()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp