Learning Python. my first program

I Decided i would try learning Python, so i chose a book on the subject from oreilly i like there books they make very good quality books and the book i chose was no exception "Learning Python" its is a very factual read listing all the fundamentals of strings, dictionaries and variables …yawn! i soon got bored of just reading about them well after 230 pages i did and decided the best way for me to learn was to decide to program something and use the book as a reference along with Google of course and then go back to reading it after i put some of the concepts in to practice .

The program i decided to write would be a stock ticker , asking you to enter your portfolio and then looking up the current prices , this project gave a lot of learning opportunities , user input , web fetching etc and also left a lot of scope for growth as i learn . adding features like profit and loss current values etc and then maybe even a GUI. From the perspective of someone who is already a programmer it all sounds very simple , but from someone who is not a programmer the concept of it all and the design of what i wanted was a real intriguing thought.

so i started my project design , my first stumbling block was to get the variables into a way they would be usable , i wanted to create a dictionary for every stock symbol that i entered containing Price and Quantity so i need to name the dictionary with the value of a variable (the stock symbol) i tried a few way and searched to find more ways with no luck so i decided to get on IRC and look for some help on there , i found a python channel and asked my question the guys on there were patient and helpful , it turns out that the way i wanted to do things was not the best way to do it and probably not even possible so i was guided to making 2 dictionaries one called price and one called quantity , the keys in the dictionaries would then be assigned form the variables with the value also being a variable , and would be easily read by humans too; for instance the price dictionary would have a key of goog and the value 132  this would mean that the price of goog would be 132.

so after setting up loops etc the whole thing went well until i came to getting the webfetch , after some googling i managed to get the web fetch working too.

so at the moment the program does function it takes your input stores as a portfolio and then gets the current prices. Next i want to implement extended features on the returned data like showing the current value of the stock with the current price and showing profit or loss percentage etc and also editing the portfolio. These are all not difficult things but will take time to do, but so far i am finding my Python experience a fun one . so stay tuned for updates and eventually the completed code.

Read and post comments | Send to a friend


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: