Tejasv Maheshwari
@TejasvMaheshwar
Am 16 yrs old and intrested in python idk why
So am trying to make a blackjack game in python as a side project but , the "stop" string isnt stopping the hitorstop() function and some of the code
Python
So am trying to make a blackjack game as project from my python course and i have to use classes no matter what
Whenever someone puts in the wrong in
Python
SixBeeps Careful, self isn't a regular parameter, so you can't just pass a value to it. Your best bet would be to move all of your input functions from out of its own class and into the Player class so you don't have to deal with that. If you choose to do so, you can keep the self object.2 years ago
I believe everythings right in that line and this project is for small school project i have to do
Python
SixBeeps Line 44, you need to add one more ) to the end of the line to end the call to int().2 years ago
Heres a ttt , and i want the whole function to start again if the user adds in a row or column position more than 3 but the code isnt working. any sug
Python
By reverse i mean , we take the output from this one and when we put in back in the revsered code we get the original input
Python
So i was following along a tutorial to make a discord bot in repl.... and whenver i print os.getenv the result is none.... whats the issue?
my env fil
Python
Please try to explain in very simple manner
to run q2.py
type "python q2.py" in shell
Python
JBloves27 So you see the line above line 9? You forgot to add a parentheses after the parentheses.
I hope this helps!2 years ago
I want to alternate between the turns of player1 and player2..... Plz explain in the simplest manner as am new to python
Python
ObiVibKenobi @TejasvMaheshwar
If you want it to be two people on the same computer, I would just have the thing print ’Player 2’s turn!’ when its player 2’s turn.
If you want to have two people on different computers, I would use socket.io
Let me know which one you want to do and if you need help with any of it2 years ago
am tryin to make a tic tac toe game for my school project .... please try to explain at very beginner lvl as am new to python
Python
GokulramA I actually don't know what do u want ur code to do, It seems to be working fine... I suppose u want the program to ask player 1's choice before player 2. Well if that's the case then just swap the code of where u call player2turn() and player1turn()
Like this...
msedge_1608888920
Swap these two lines of code.
msedge_16088890642 years ago
Wumi4 The reason is because you defined the player2turn before the player1, so Python doesn't recognize it and return error. Just move the code of player2turn before the player1 and it should fixed.2 years ago
Please try to be as basic as possible .... am new to coding
Python
InvisibleOne Because you aren't assigning them to anything, try this code:
string = "python is also the scripting language"
l1 = string.split(" ")
l1[0] = l1[0].upper()
l1[-1] = l1[-1].upper()
print(l1)
`2 years ago
Please try to explain in very simple language ....as am a newbie to both coding and python
Leroy01010 you need to import time, then set the time that it started at, and then minus that from the time that it ended (see code below)
import time
timeStart = time.time()
choice = input("Enter choice:\n")
timeEnd= time.time()
timeTaken = timeEnd - timeStart
print("That took: " + str(timeTaken) + "seconds")3 years ago
Am a new to coding and decided to learn python as my first language..
can anyone tell me why my output is always "Your answer is wrong"
VulcanWM Your answer is always wrong, because the answer you are inputting is a string, and the answer that is generated is a integer. The integer is never equal to the string, so the answer shows that it is wrong. You should probably use the code:
z = int(input(“Type in the answer”))
> Mark this as the answer if it was helpful or useful3 years ago
Please answer my question as simple as possible as i am a newbie.....
Python
Bookie0 Hey there,
Line 21 I don’t think yOu should write print after the input,
560A4A6F-328C-4C16-8E50-10827B020AAB
instead it should look like this:
hint = input(“Do you want a hint\nY for yes \nN for no”)
`3 years ago
flafflar It's because in line 21 you used a print statement inside an input one. If you want something to be print before an input command, you can put it directly inside the input command like this:
hint = input("Do you want a hint \nY for yes \nN for No ")
This will do what you want3 years ago
Kai_Justice There's a print statement inside of the input statement on line 12, you can just put text there with print if you want it to prompt the player.
hint = input("Do you want a hint \nY for yes \nN for No ")
`3 years ago
How to restart a python program also
if there is any way i can ask the user to type in the correct inputs
Python
CircuitSacul I see that people have answered your second question, but not the first. I don't think that there is a way to restart a python program from within the file, unless you put it in a function and just told it to re-run the function, then break the original, like this:
def main():
#main code here
#to "restart" program:
main() #this just re-runs the program that is currently running
exit() #this tells the python program to stop completely
main()
If you need a better example just let 3 years ago