Hello,
This is my first time here on dev.to. I need some help fixing a code.
See I'm learning Python from scratch and created this simple game pro...
For further actions, you may consider blocking this person and/or reporting abuse
Hi,
You have assigned 'rolling_again' to 'yes' at the start of your program. Once you enter the 'while' loop, rolling_again's value is not changed in any way.
You have to put the entire block of code starting from the if condition to end of the program inside the while loop. That way, each iteration, you can get user input and proceed based on that.
Hope this helps.
Yes! It works! Thank you!
Regarding the random numbers, you need to seed random with a changing number. Not seeding, or always seeding with the same number, will result in the same random numbers being produced.
So, the most common way around this is to use the current time to seed random.
(Disclaimer: While this is what I've used for years in Python, I double-checked the exact syntax like I always do. This version comes from this StackOverflow answer)
It also worked out. Thank you!
My favourite is sticking this in the loop to stop it and ask for user input.
action = rawinput(" > ")
the other one I like using is, While not True, than in side your if statement make it True once you've done what you want.
On the topic of endless loops, try out Florian Rohrer's Endless Loop Challenge. It was a fun exercise.
Just checked it out, and posted my own code there. It's fun! :D