Question

I have not understood why they write round(x[,n]) in syntax, but in codes they write round(10.6987,12) without square brackets before comma i.e, round(10.6987[,12])

Was it helpful?

Solution

The square brackets aren't intended to by typed into your code. They just indicate that n is an optional parameter.

This style is recommended in the Documenting Python guide:

function

Describes a module-level function. The signature should include the parameters, enclosing optional parameters in brackets. Default values can be given if it enhances clarity. For example:

OTHER TIPS

Square brackets are just a convention used to indicate optional arguments.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top