Name a price, a ticker and a share count, then value a position and a three-stock portfolio.
A variable is a name for a value. You create one with =, putting the name on the left and the value on the right.
Every value has a type. type(x) tells you which one. In this lesson I name three values, check their types, and then use them to price a single position and a portfolio of three holdings.
Step 1. Name a price, a ticker and a share count
Three values, three names. The three types here are float (a number with a decimal point), str (text in quotes) and int (a whole number).
price =185.40# a float: it has a decimal pointticker ="AAPL"# a str: text, always in quotesshares =10# an int: a whole numberprint(price) # -> 185.4print(ticker) # -> AAPLprint(shares) # -> 10print(type(price)) # -> <class 'float'>print(type(ticker)) # -> <class 'str'>print(type(shares)) # -> <class 'int'>