Domanda

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])

È stato utile?

Soluzione

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:

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top