To print the latest price of the company whose NASDAQ symbol will be given in the command line
Solution:
Modules are imported using the command import.
A function share is defined to get the latest share price of the company.
The link of the site to get the price is stored in a variable named
share_link.
The site(stored in the variable share_link) returns the latest value of the company by using the command urllib2.urlopen(share_link) and it is stored in the variable share_value.
The share value of the company is being read by the command share_value.read() and is stored in the variable s.
The share value of the company is printed by the print command.
Then checking is made whether only one input is given or not in the command line by the command if __name__=='__main__':
The program returns an error if more than one input is used.