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

27th Jul 2021, 10:43 AM
Tomoe
Tomoe - avatar
2 Answers
+ 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.
27th Jul 2021, 12:02 PM
Hatsy Rei
Hatsy Rei - avatar
+ 16
Tomoe If you define a function then you can give any value to the arguments unless it is specified for some particular value.🍃
27th Jul 2021, 10:54 AM
SωAti
SωAti - avatar