Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~6K People Reached
Favorite Forums
Favorite Tags
Member Avatar for macca1111

HI, I have written a small program that uses a while loop to calculate how many years it takes for an investment to double given an interest rate: However, I think there is something minor wrong with the calculation for years, since when testing I put in 100% it should …

Member Avatar for NoddyNUIG
0
4K
Member Avatar for macca1111

Hi, I have created the following code to check a list and then determine which is true then update the variables associated with the correct if else statement. My problem is it doesn't update any of the variable even if true. As you can see, the var ch should be …

Member Avatar for vegaseat
0
127
Member Avatar for macca1111

Hi, I have a card class and deck class. The cards are in suitList rankList. I call the cards from a file cards.txt and split them into the above. I need to import the cards.txt and then shuffle them. I have the following code: def shuffle(self): import random nCards = …

Member Avatar for macca1111
0
179
Member Avatar for macca1111

Hi, I have a class for Cards, that the suits and ranks are placed in suitList = ("Hearts","Diamonds"... rankList = ("","Ace","2"... however I need to read these values from a file instead. Once I read the file I need to be able to sort the suits and ranks then print …

Member Avatar for macca1111
0
102
Member Avatar for macca1111

Hi, I need some help on how to read a file 2 h 3 s 6 d Ace s ... Importing this into Python and then sorting and printing in order. I have done some work, yet I can never seem to get the data to Python and split it …

Member Avatar for macca1111
0
298
Member Avatar for macca1111

Hi, I have the following code working fine. What I would like to try is when n cards are randomly selected, to print the cards in a graphics window. I want to add a new class draw(self,win,center) that displays the card. I have a set of bmp cards. [php]# Import …

Member Avatar for Zonr_0
0
1K
Member Avatar for macca1111

Hi, A simple question I think. I want to create a function that updates variables if a certain condition is met. For example def main(): c=d=e=0 if c[1] == 0: c=c+1 d=d+1 e=e+1 I want to create a function that adds the 1 to c,d,e automatically. def BB(c,d,e) Add 1 …

Member Avatar for Ene Uran
0
79
Member Avatar for macca1111

Hi, I have the following code: import string def main(): rank=[] suit=[] fname=string.split(open('H:\card.txt').read()) for line in fname: rank.append(line) print rank The file (card.txt) is: 2 h 3 h ... How's the easiest was to get the 2 into rank and the h equal hearts Ultimately i need it to print: …

Member Avatar for Ene Uran
0
122
Member Avatar for macca1111

Hi, If the following def shows if a deck is empty, how do I change it to show the number of cards left??? def isEmpty(self): return (len(self.cards) == 0) I was thinking just taking the ==0 should work, by returning number of cards. macca1111

Member Avatar for Ene Uran
0
101
Member Avatar for macca1111

Hi, I was running Python 2.3 an although I had a few problems it generally worked. I today tried to upgrade to 2.5 and it installs (apparantely) ok, yet when I click on the IDLE icon nothing happens. No error message, nothing. I can however click on the Python (Command …

Member Avatar for macca1111
0
76