#πŸ”’ struggling

22 messages Β· Page 1 of 1 (latest)

gloomy geyserBOT
#

@latent sun

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

#

Hey @latent sun!

It looks like you're trying to paste code into this channel.

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
latent sun
#

This is the output for printing the the state
[3, 6, 1, 0, 5, 7, 4, 2]

pale nova
#

!paste maybe post all of the code cause it's hard to understand from this bit

gloomy geyserBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

latent sun
#

I was about to but I just realised I did something entire stupid whilst pasting it going to try to see if changing it works first

#

@pale nova any ideas please?

pale nova
#

If I understand it correctly you want to create list of random integers except for one

latent sun
#

yes, I want to exclude the fixed queen column since its placed separately and than skip the column its in to place the over queens in the correct columns on random rows

pale nova
#

How about you generate the list of ints and then afterwards update for the fixed queen

#

!e would something like this work for you or are you limited on how you are supposed to construct it.

import random
fixed_row = 2
fixed_col = 5
randlist = random.sample(range(0, 8), 8)
randlist[fixed_row] = fixed_col
print(randlist)
gloomy geyserBOT
#

@pale nova :white_check_mark: Your 3.12 eval job has completed with return code 0.

[6, 7, 5, 4, 3, 5, 0, 2]
pale nova
#

Ah, just realized you can't have 2 queens in the same position

latent sun
#

not on this function but rethinking it i'm more confused with my own code now i'm just trying a bunch of things i'll show you my current output

pale nova
#

I am not familiar with the queens problem so don't ask me for specifics on it. Maybe someone else who understand it better can jump in

#

If you want a list of random ints there are various ways to do that.

latent sun
#

I think i got the list part down ```py
Initial board:

              • Q
    • Q - - - - -
          • Q - -
      • Q - - - -
        • Q - - -
          Q - - - - - - -
  • Q - - - - - -

Solved board:

          • Q - -
    • Q - - - * -
      Q - - - - - - -
              • Q
        • Q - - -
  • Q - - - - - -
      • Q - - - -
            • Q -``` I've somehow got the extra queen removed from the initial board so that's a little progress... I think
#

thanks for the help I'm going to just stop working on it for an hour and hope it fixes itself🫠

gloomy geyserBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

πŸ”’ struggling