A Python programme will randomly create runs or wickets when the user enters the input ‘1’. The scorecard and overs are visible to the user after each hit.
We used to play the cricket game as children using a book (Book Cricket). We open any page of the book at random, and the last digit of the page number determines our score. For instance, if the final digit is zero, the player is dismissed.
I made this single-player game with the same logic in mind. To hit the ball, the user must enter '1'. The programme then assigns a random score to the ball. After each hit, the user can view his or her scorecard. The user can also set overs to play.
View the sample output.