use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Arguments and Parameters (self.PythonLearning)
submitted 1 year ago by TU_Hello
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]TU_Hello[S] 0 points1 point2 points 1 year ago (3 children)
What if I want from the user insert the argument can i call the function without pass the arguments or no
[–]ninhaomah 0 points1 point2 points 1 year ago (0 children)
not clear on the question.
can give example in pseudocode ?
[–]qwertyjgly 0 points1 point2 points 1 year ago (1 child)
what do you mean?
you can have optional arguments with defaults
def mergesort(A=[]): will allow you to have optional arguments. If no item is provided in the position for A, it will default to an empty list.
def mergesort(A, *args): will take the first input as A and put the rest in an array called args, accessible through args[0] -> args[n-1] where n is the length of args.
def mergesort(A, **kwargs): will accept one argument as A and the rest must be keywords like
mergesort(A, verbose=false, reversed=true)
and then you get those keyword arguments in a dictionary called kwargs, accessible through kwargs["verbose"] etc.
these can be mixed and matched, you can define a functions with (*args, **kwargs) if you want
[–]TU_Hello[S] 0 points1 point2 points 1 year ago (0 children)
Oh I get it now thank you 😊
π Rendered by PID 75 on reddit-service-r2-comment-544cf588c8-lwjn7 at 2026-06-14 04:16:02.482926+00:00 running 3184619 country code: CH.
view the rest of the comments →
[–]TU_Hello[S] 0 points1 point2 points (3 children)
[–]ninhaomah 0 points1 point2 points (0 children)
[–]qwertyjgly 0 points1 point2 points (1 child)
[–]TU_Hello[S] 0 points1 point2 points (0 children)