- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
10 Posted Topics
[CODE] n = 1 for i in (range(1,10)): print ("%d*8+%d=%d" % (n, i, (n * 8 + i))) n = n * 10 + i + 1 [/CODE] does the n = 1 have to stay outside the for loop?
[CODE] class Player(object): def __init__(self): self.points = 0 def add_points(): plyr1.points += 1 plyr2.points += 1 plyr3.points += 1 if __name__ == '__main__': (plyr1, plyr2, plyr3 = (Player(), Player(), Player()) add_points()[/CODE] How could the 3 lines in add_points() be written better/shorter?
Looks to me like [CODE]card.suit[/CODE] is giving you that error b/c there hasn't been a Card class object created, no? You created a Poker object in [CODE]game = Poker(numhands)[/CODE], but i don't see where a Card object occurs. Could need some thing like [CODE]cards = Card()[/CODE] under main(). Do the …
What are some alternatives to writing [CODE]len(mylist3 & mylist4)[/CODE] within this code? [CODE] mylist1 = [1,2,3] mylist2 = [4,5,6] mylist3 = set(mylist1) mylist4 = set(mylist2) lenresult = len(mylist3 & mylist4) [/CODE] A module i'm importing is unable to use the count() that gets called with the ' & ' operator.
Have you first created the 5-card hand? What do you ultimately want the hand sorted by? Rank, suit or poker hand? ex. a 5 card hand that contains a pair sorted by rank could look like this: 2s, 3d, 6h, 6c, Ad or sorted by what the poker hand is …
If you start an open source project, say on code.google.com to develop a game, how is revenue from that game distributed? Assuming you or the contributers have found a way to monetize it.
Any direction on this?
If I want to find the X coordinate of an image that's already on a canvas, how would I do that with tkinter?
How would you modify this gui code to designate only certain spots on your canvas to drop your image? Like when your playing solitaire and the game only allows you to drop your card in a certain spot. [URL="http://www.daniweb.com/forums/post1111987.html#post1111987"]http://www.daniweb.com/forums/post1111987.html#post1111987[/URL]
What approach should I use to return all dict keys that have the maximum value. The code below outputs 1, but I would like for it to return 1, 2. [CODE]import operator d1 = dict() d1[0] = 1 d1[1] = 2 d1[2] = 2 maxValue = max(d1.iteritems(), key=operator.itemgetter(1))[0] [/CODE]
The End.
bpatt22