The 3 basic programming structures are SELECTION (if....elif....else), and ITERATION (while and for loops). You will find more about these on the Loops page.
The CSNEWBS site covers these in sections 4 and 6.
The CSNEWBS site covers these in sections 4 and 6.
Now take the test
Programming task - you can download Thonny here or use an online Python editor such as replit.com/
Create a roll the dice program similar to that shown in the video.
Two dice should be rolled. While the two dice are equal the dice should roll again. (HINT: while.....) The output will be the values of the dice rolled and a sentence saying which dice won. For example: Dice 1 rolled 4. Dice 2 rolled 6 Dice 2 is the winner! Extend the program by: 1. taking in the players names and using them in the output 2. playing 'best of 5' - HINT: use a counter and a while loop 3. keep a score of who wins the best of 5 and output this at the end |