#๐ this python code is running and interpreting really slow in vscode , is it resolvable?
31 messages ยท Page 1 of 1 (latest)
@bright jolt
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 @bright jolt!
It looks like you are trying to paste code into this channel.
You seem to be using the wrong symbols to indicate where the code block should start. The correct symbols would be ```, not '''.
Here is an example of how it should look:
```
Hello, world!
```
This will result in the following:
Hello, world!```
You can **edit your original message** to correct your code block.
!paste
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.
Use that,
print(' ')
print(' ')
print(' ')
print('do you want to play tic tac toe ?')
print(' ')
a=int(input(''' 1. yes
2. no(exit) '''))
print(' ')
print(' ')
if a==1:
l1=[' ','|',' ','|',' ']
l2=['___________']
l3=[' ','|',' ','|',' ']
l4=['___________']
l5=[' ','|',' ','|',' ']
rules_check=(input('''Here is some "general" info about the game and notation:
|
| 1. position names of matrix : tl|tm|tr
| ________
| ml|mm|mr
| ________
| bl|bm|br
| 2.abbrviations : tl: top left
| tm: top middle
| tr: top right
| ml: middle left
| mm: middle middle
| mr: middle right
| bl: bottom left
| bm: bottom middle
| br: bottom right
|
| 3. only 'X' (capital and small for both) and 'O' are allowed ,
| anything else as input will end the
| game and
| other persom is declared as winner
|
|
| press enter if u read the info : '''))
```
print(' ')
else:
print(' ')
tl,tm,tr,ml,mm,mr,bl,bm,br =' ',' ',' ',' ',' ',' ',' ',' ',' ' # type: ignore
r1=[' ' , tl , ' | ' , tm , '| ' , tr ]
r2=[' ' , l2[0]]
r3=[' ' , ml , ' | ' , mm , '| ' , mr]
r4=[' ' , l4[0]]
r5=[' ' , bl , ' | ' , bm , '| ' , br]
print(' ')
print(' ')
print(' ')
b=int(input('''select the difficulty level:
1. 2 player
2. easy(with bot)
3. hard(with bot)'''))
if b==1:
r1=[' ' , tl , ' | ' , tm , '| ' , tr ]
r2=[' ' , l2[0]]
r3=[' ' , ml , ' | ' , mm , '| ' , mr]
r4=[' ' , l4[0]]
r5=[' ' , bl , ' | ' , bm , '| ' , br]
print('you have chosen 2 player mode')
c=input('enter player 1 name: ')
d=input('enter player 2 name: ')
print(c + ' VS ' + d)
print(' ')
print('_______GAME STARTS_______')
print(' ')
print(' ')
li1=[c,d]```
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.
please โค๏ธ
ah
it just instantly deletes the file i sent
Go to this url: https://paste.pythondiscord.com/ paste all the code there, hit the save button, and send the url
oki
the code is only 1/4th complete but it is slowing to interpret in vscode so much that i have to restart vscode everytime i have to see if there is an issue in my code or not , or it just spits out the older problem in my code which i have resolved
you have like 3 nested loops
if you think slow is bad, then yeah
I tried running your code but I'm getting a Syntax Error at line 255
o damn , gotta find new method them , thankyou for pointing the issue out btw
Can you reshare/repaste the code without the break of #... (previous code)
yeah it isn't complete yet
try breaking up your code into smaller functions
ohh , i'll try
Also something like this:
print(r1[0]+r1[1]+r1[2]+r1[3]+r1[4]+r1[5])
(if r1 is a list of strings) can be simplified to:
print(''.join(r[:5])
``` (If the length of the list is only `5` `''.join(r)` would work too
if it's not strings but rather integers or something else it can easily be broken into this, though I would do the top one if it applies to you
```py
print(*r[:5], sep="")
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.
