#This simple Function for string does not work
20 messages · Page 1 of 1 (latest)
Can you show how you're using the return from this function?
I feel like this function should explode given you're mirroring a variable name from the global scope.
box[UserInput] = Crtmark
#It is a tic tac toe program, so its for marking X or O
before i tried using a variable inside function and making it global but it was not working, this approach doesn't work but it shows some progression.
You're not using the function on that line. The variable inside the function has no effect on the variable outside the function. You need to capture the functions return into a variable.
Crtmark = MarkChoice_f()
Your function is very likely broken though.
It doesn't account for invalid inputs
I was attempting to do that but python does not have do-while loops, i was breaking more stuff than was fixing
I'll try to finish it tomorrow
Why do you need a do/while?
its easy with it to avoid invalid input
Doesn't seem to work
"cannot access local variable 'Crtmark' where it is not associated with a value"
Can you show the code that's giving that error? (I'm at work so may not respond right away)
box[UserInput] = MarkChoice_f() ```
Thank you for giving me time
Ok yeah that's what I thought would happen. You're not accounting for when the input isn't valid. What did you enter when you got the input prompt?
Just a quick question, assuming you work a CS job, do coding or such are always like trying to solve bugs or getting your code to get to work or do just beginners get too many bugs and are stressed by them?
It asked for input twice
2 first time and 4 second time, after 4 it crashed