Confused with to use dots or parantheses


#1



Just a little confused on when to use which syntax. Some times it seems like my variable should be variable.method() and others seem like method(variable). Such as...


len(parrot)
parrot.lower()


That was just from one lesson to the next. Is there a way to tell going forward when something should go before and when it should go in parentheses?


#2

In the Dot Notation lesson you'll know it.

Methods that use dot notation only work with strings.

On the other hand, len() and str() can work on other data types.


#3

a little elaboaration on rcodeman's post, examples include .condition, .angle, etc
in future, you will get to use .variable, where variable can be anything you set is as.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.