Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Publishing two boards side by side
Post: RE: Publishing two boards side by side

(May-15-2019, 01:28 PM)ichabod801 Wrote: Maybe I don't understand the problem correctly, but if you are just printing this out on a terminal, it should be easy. Print a header row with the numbers 1...
DJ_Qu General Coding Help 4 2,498 May-15-2019, 03:12 PM
    Thread: Publishing two boards side by side
Post: Publishing two boards side by side

Hello, We are implementing a simple console game of battleship. It has two boards (one human, one AI). I want to have numbers 1 to 10 in a column next to the boards, and 1 to 10 over the boards to avo...
DJ_Qu General Coding Help 4 2,498 May-15-2019, 07:28 AM
    Thread: module logging posting randomly
Post: RE: module logging posting randomly

I don't think I use multiple threads. My code is nothing special, I have an import loggingat the top and then a series of logging.debut('Game engine init ...') logging.debut('Player one initialised...
DJ_Qu General Coding Help 2 2,226 May-14-2019, 06:41 AM
    Thread: module logging posting randomly
Post: module logging posting randomly

Hello, I am writing a program with a lot of print() so I use the module logging for debugging purposes. The problem is that when I put logging.debug('some text') in the code, it dumps debugging inform...
DJ_Qu General Coding Help 2 2,226 May-14-2019, 03:48 AM
    Thread: Automate the boring stuff: regex not matching
Post: RE: Automate the boring stuff: regex not matching

Is it me or regex is a headheache?? Thank you for your help!
DJ_Qu General Coding Help 7 3,810 Apr-24-2019, 07:08 AM
    Thread: Automate the boring stuff : the tic tac toe game
Post: RE: Automate the boring stuff : the tic tac toe ga...

Hello, So I should iterate over the tuple and check if all strings are equal. I can do that :) Is there any way to minimize code duplication any further? There is 8 cases for win? Maybe if I put the ...
DJ_Qu General Coding Help 7 6,686 Apr-24-2019, 03:40 AM
    Thread: Automate the boring stuff: regex not matching
Post: RE: Automate the boring stuff: regex not matching

Great! phone3 = r'{p}(?:[\s,]\s*{p}){{2}}\,?'.format(p=phone) So{p} is phone, your first regex. Can you please explain shortly what are the regex that follow?
DJ_Qu General Coding Help 7 3,810 Apr-24-2019, 03:34 AM
    Thread: Automate the boring stuff: regex not matching
Post: RE: Automate the boring stuff: regex not matching

Hi, That's not what I need. I need a regex that returns a result only if I have a group of 3 phone numbers one after the other.
DJ_Qu General Coding Help 7 3,810 Apr-23-2019, 08:29 AM
    Thread: Automate the boring stuff: regex not matching
Post: Automate the boring stuff: regex not matching

Hello, I am trying to do the exercise on regex, matching 3 telephone numbers i a row, with or without area code, with or without comma at the end: >>> phoneRegex = re.compile(r'((\d\d\d-)?\d...
DJ_Qu General Coding Help 7 3,810 Apr-23-2019, 04:47 AM
    Thread: Automate the boring stuff : the tic tac toe game
Post: RE: Automate the boring stuff : the tic tac toe ga...

Ok, I asked the wrong question here. How would I know I have a win based on my tuples?
DJ_Qu General Coding Help 7 6,686 Apr-22-2019, 12:08 PM
    Thread: Automate the boring stuff : the tic tac toe game
Post: RE: Automate the boring stuff : the tic tac toe ga...

(Apr-21-2019, 12:20 PM)ichabod801 Wrote: The way I have done this in the past is to have a list or tuple of the sets of winning keys, and iterate over that: WINS = (('top-L', 'top-M', 'top-R'), ('m...
DJ_Qu General Coding Help 7 6,686 Apr-22-2019, 04:38 AM
    Thread: Why do we need setdefault() method for dictionnary?
Post: RE: Why do we need setdefault() method for diction...

I get that... But why does it work in the shell? Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license()" for...
DJ_Qu General Coding Help 3 2,714 Apr-21-2019, 10:59 AM
    Thread: Why do we need setdefault() method for dictionnary?
Post: Why do we need setdefault() method for dictionnary...

I rewrote the following exercise: allGuests = {'Alice': {'apples': 5, 'pretzels': 12}, 'Bob': {'ham sandwiches': 3, 'apples': 2}, 'Carol': {'cups': 3, 'apple pies': 1}...
DJ_Qu General Coding Help 3 2,714 Apr-21-2019, 09:22 AM
    Thread: Automate the boring stuff : the tic tac toe game
Post: Automate the boring stuff : the tic tac toe game

Hello, I have a question about "a tic-tac-toe game" using dictionary in automate the boring stuff. https://automatetheboringstuff.com/chapter5/ Instead of checking if the game has a winner by looking...
DJ_Qu General Coding Help 7 6,686 Apr-21-2019, 07:48 AM
    Thread: Automate the boring stuff, inserting commas in list
Post: RE: Automate the boring stuff, inserting commas in...

(Apr-21-2019, 04:50 AM)Gribouillis Wrote: spam.insert(i, 'and') inserts at index min(len(spam), i) when i is non negative and at index max(0, len(spam) + i) when i is negative. Sorry, I don't get it...
DJ_Qu General Coding Help 3 4,720 Apr-21-2019, 07:42 AM
    Thread: Automate the boring stuff, inserting commas in list
Post: Automate the boring stuff, inserting commas in lis...

Hello! I cannot figure out something about negative indexes in that exercise of automate the boring stuff: " Comma Code: Say you have a list value like this: spam = ['apples', 'bananas', 'tofu', 'c...
DJ_Qu General Coding Help 3 4,720 Apr-21-2019, 04:17 AM

User Panel Messages

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