Python Forum
"Card Dealing" Python code 2.7
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Card Dealing" Python code 2.7
#3
(Nov-17-2016, 09:48 PM)Paradoxalis Wrote: Part of my belief is that my computer may just not be able to handle the proccessing of 1000 runs through.
1000 is nothing. The var Count was over a million by the time i got to ctrl + C to kill your program.

your whole code reeks of C style. I would suggest a complete change, but to answer why you code does not work....

you pretty much created an infinite loop by not allowing the exit clause to ever execute.
Quote:
    elif Count == 1000:
        print "1000 cards have been dealt"
        break
this never executes because the var Cards is always between 0-53, and the if conditions before it checks for all these, never allowing the last elif to execute because one before it always does.

what you are looking for is to create a second if structure by doing this instead
    if Count >= 1000:
or make the condition in the while loop
Recommended Tutorials:
Reply


Messages In This Thread
"Card Dealing" Python code 2.7 - by Paradoxalis - Nov-17-2016, 09:48 PM
RE: "Card Dealing" Python code 2.7 - by micseydel - Nov-17-2016, 11:18 PM
RE: "Card Dealing" Python code 2.7 - by metulburr - Nov-17-2016, 11:28 PM
RE: "Card Dealing" Python code 2.7 - by Larz60+ - Nov-17-2016, 11:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Excel from SAP - dealing with formats and VBA MasterOfDestr 7 667 Feb-25-2024, 12:23 PM
Last Post: Pedroski55
  UnicodeEncodeError - Dealing with Japanese Characters fioranosnake 2 2,532 Jul-07-2022, 08:43 PM
Last Post: fioranosnake
  Having strange results from an RFID HID card reader - I'm stuck orbisnz 1 1,521 Mar-28-2022, 08:20 AM
Last Post: Larz60+
  SQL wild card use hammer 3 1,304 Jan-07-2022, 02:17 PM
Last Post: hammer
  Dealing with duplicated data in a CSV file bts001 10 11,713 Sep-06-2021, 12:11 AM
Last Post: SamHobbs
  Dealing with a .json nightmare... ideas? t4keheart 10 4,463 Jan-28-2020, 10:12 PM
Last Post: t4keheart
  Dealing with Exponential data parthi1705 11 9,913 May-30-2019, 10:16 AM
Last Post: buran
  Credit card number redacting script Drone4four 6 5,308 Jan-18-2019, 02:07 PM
Last Post: Drone4four
  Dealing with multiple context managers heras 5 4,776 Nov-16-2018, 09:01 AM
Last Post: DeaD_EyE
  Validating credit card frequency 8 4,264 Nov-05-2018, 07:36 PM
Last Post: frequency

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020