Positional arguments | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Positional arguments

Why do I need to put n on star? I couldnā€™t find a clear answer online. def decor(func): def star(n): print("***") func(n) print("***") print("END OF PAGE") return star

27th Apr 2021, 6:02 AM
Michael Emerson
3 Respostas
0
Put N on star? Unless that is a typo, i think this is a misunderstanding. The print statements with asterisk strings are just visual bounding lines for the program userā€™s visual convenience, and are not essential to this code. Removing those print statements will not cause an error.
5th May 2021, 11:57 AM
Wilbur Jaywright
Wilbur Jaywright - avatar
0
I meant putting n into the parenthesis of star
5th May 2021, 1:40 PM
Michael Emerson
0
The parentheses of star? I dont seeā€¦ oh, i thought you meant asterisk. Okā€¦ n is a parameter of the function star, which is being defined within the function decor. Decor takes func as an argument, star takes n as an argument and calls func on it.
5th May 2021, 2:49 PM
Wilbur Jaywright
Wilbur Jaywright - avatar