- #1
- 2,111
- 2,691
Recently in college, we have started learning python. I found that the
I have learned Java for nearly four years, and I know that something like this is not possible there. If I have to print three variables, I have to write
How does python and/or Matlab work in this regard? I put in multiple variables as arguments, and that is accepted! Overloading is certainly not a solution here.
In addition, if I want to define a separator in python
print
statement can accept multiple variables. For example, if I have variables x1, x2 and x3, I can write print(x1, x2, x3)
in python. Something similar exists in Matlab as well.I have learned Java for nearly four years, and I know that something like this is not possible there. If I have to print three variables, I have to write
System.out.println("" + x1 + x2 + x3);
, that is, concatenate the variables. I can put multiple arguments only if the function definition allows me to do that. I cannot just put the variables as arguments; rather, I have to concatenate them as a string.How does python and/or Matlab work in this regard? I put in multiple variables as arguments, and that is accepted! Overloading is certainly not a solution here.
In addition, if I want to define a separator in python
print
statement, I can mention that using sep = ' '
as an argument in the function call. But how does python recognise this as the separator only using the keyword "sep"?