+ 1
functions
alright about this "wor" like i still can't get how this even works, like can i just use any set of words(any characters and all) def this(wor): print(wor + '!') this('this word') this('is weird') output: this world! is weird!
2 ответов
+ 4
Stuff within quotes are strings. E.g.
"string"
'another string'
Stuff not within quotes are identifiers, e.g. variables
myVar = "some string"
In your example, wor is an identifier, which is used as a function parameter. Parameters allow a function to accept arguments. Whatever you pass to the function will be stored in wor, which you can then use as a variable within that function.
+ 16
Tomoe
If you define a function then you can give any value to the arguments unless it is specified for some particular value.🍃