Question: PYTHON #No list can be used(sequence) or arrays. #####Use LOOPS And IF Statements Only ##### #Its for intro to python #teacher wont accept it if
PYTHON
#No list can be used(sequence) or arrays.
#####Use LOOPS And IF Statements Only #####
#Its for intro to python
#teacher wont accept it if other things are used.
There are numerous dice games that can be easily converted into code. One of them is 'Run For It'. In this game
the player rolls 6 dice. The player then examines the dice to see if there is a sequence. For instance
if the user rolled:
2
5
6
1
3
5
There is a sequence of 1, 2, 3. If there is a sequence, the player wins and earns points for each number in the sequence. In the example above, the player's score would be 3 since 3 numbers were found in sequence. In another turn, if the player rolls:
3
4
6
2
2
5
Although there is a sequence here: 2, 3, 4, 5, 6, the player does not win and does not earn any points because all sequences must begin with 1.
Requirements:
Create a Python program that mimics this game. In order to 'roll the dice' you will need to randomly generate 6 numbers between 1 and 6. Additionally, you will need to allow the user the ability to play the game multiple times. Your game will need to print out, what the user rolled and any sequencing found. Finally, the program needs to print out the score.
When run your program should look something like the following:
You rolled.....
4 1 2 3 3 2
==================================
Verifying Sequencing
dice 2 : 1
dice 3 : 2
dice 4 : 3
dice 1 : 4
Congratulations
you won!
score: 4
Total Score: 4
Enter 'quit' to end:
You rolled.....
1 4 6 2 2 2
==================================
Verifying Sequencing
dice 1 : 1
dice 4 : 2
Congratulations you won!
score: 2
Total Score: 6
Enter 'quit' to end:
You rolled.....
4 6 3 4 4 5
==================================
Verifying Sequencing
Sorry you lost
Total Score: 6
Enter 'quit' to end: quit
Some Help With the Logic
This program involves 2 loops and an IF structure. Remember to start with the inner loop and figure out how one roll of the dice works. You are looking for sequencing. First you will need to check your dice to see if one of them is a 1, then a 2 and so on. Using a loop to do this makes your job a lot easier because you have to write less code. Don't forget that you can use your counter within your code.
NO ARRAY, SEQUENCE OR LIST CAN BE USED
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
