I did some detective work to find the stock trading value for a given ticker symbol. See if you can use the fruits of my labor and turn this into a more general portfolio tracker:
print("%s has mobile = %s" % (key, name_dic[key].mobile))
# to save the data, you can simply save it as a text file
# where each line is name, home, mobile, e_mail
filename = "Names1.txt"
fout = open(filename, "w")
for key in name_dic:
k = name_dic[key]
s = "%s,%s,%s,%s\n" % (key, k.home, k.mobile, k.e_mail)
fout.write(s)
fout.close()
"""
my output -->
bob.dork@hotmail.com
----------------------------------------
Name = frank millato
Home Phone = 123-456-7890
Mobile Phone = 456-789-0123
Email = frank23@gmail.com
Name = bob dork
Home Phone = 234-567-8901
Mobile Phone = 567-690-1234
Email = bob.dork@hotmail.com
----------------------------------------
bob dork has mobile = 567-690-1234
"""
Expand the data with the home address of the person.
How would you read the data file back into the program?
Also, query for data input and allow for editing of data.
Write a program that goes through a folder of source/text files and lists all the file names that contain a given search word (or combination of search words).
If you run this code, you will see that the hexagon rests on its side. Your challenge will be to rewrite the function so it will draw the hexagon resting on its tip.
Last edited by sneekula; Sep 13th, 2009 at 8:50 pm.
I don't know if this is appropriate for a beginner but I suggest designing a simple TicTacToe game for 1on1 mode because vs the computer is way harder to program. Try to create the 3x3 play field and check whether a player wins or loses.
Write a program that calculates the day of the week for a date from 1900 onward having in mind that 1 January 1900 fell on a Monday
The program should be able to calculate any day for a year >= 1900
Perhaps a GUI for it aswell....
Make sure you check for leap years...
Last edited by masterofpuppets; Oct 15th, 2009 at 11:44 am.
maybe a simple program to take a string and print it out backwards
Then extend the program to check whether a word is a palindrome, i.e can be read the same way in either direction.
Further extension is to configure the program to determine whether a whole sentence is a palindrome.
Hint: remove all non-letter characters from the string first, including whitespaces