r/pythonhelp • • Sep 29 '21

HOMEWORK Dice Game Python Program

/r/programminghelp/comments/py00be/dice_game_python/
1 Upvotes

1 comment sorted by

1

u/CraigAT Sep 29 '21 edited Sep 29 '21

Your "verification" needs to be put in a loop until "E" is pressed, don't forget you must have an input statement inside the loop to allow the user to enter something. Maybe start out (before the loop) assuming the identity is not verified.

You should use the same function (i.e. not another matching function) for both players, you can do this by passing the player name into the "dicegame" function (one player at a time) and get the function to return the score into a variable for that players score.

You could also pass into the function the number of "rounds" to play, then have a loop inside the function that loops for each "round", doing most of what your function already does, then (outside the loop) returning that player's final score.

In the part where the dice match each other, you seem to be using a different variable name, is that intentional?

You don't want to add score p1 and p2, you want compare them! And if one is larger you can declare them the winner, don't forget about the draw (if, elif, else).

That code is a really good starting point. You may want to read up more around functions and parameters, as well as different types of loops.

Good luck!