- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction_varargs.py
More file actions
Latest commit
32 lines (29 loc) · 851 Bytes
/
Copy pathfunction_varargs.py
File metadata and controls
32 lines (29 loc) · 851 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
# -*-coding:utf-8-*-
importos
frommathimportfabs
frommathimportfsum
# def total(a=5, *numbers, **tuples):
# print("a=", a)
# for numberitem in numbers:
# print("numberitem[{}]={}".format(numbers.index(numberitem), numberitem))
#
# for tupleitem1, tupleitem2 in tuples.items():
# print(tupleitem1, tupleitem2)
#
#
# print(os.getcwd())
# print(fabs(-16))
# print(fsum([1, 2, 3, -5]))
# if __name__ == "__main__":
# print("内部自己调用了")
# print(total(10, 1, 2, 3, 4, 5, Jack=1123, John=2231, Inge=1560))
# else:
# print("被外部调用了")
defgreet_users(names):
print(names)
"""向列表中的每位用户都发出简单的问候"""
fornameinnames:
msg="Hello, "+name.title() +"!"
print(msg)
usernames= ['hannah', 'ty', 'margot']
greet_users(usernames)