Positional arguments | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answers
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