Question: Question Create two variables: first and last. Assign 1 to first and 6 to last. Then replace the magic numbers in your code with the

Question

Create two variables: first and last. Assign 1 to first and 6 to last. Then replace the magic numbers in your code with the new variables youve just created.

Here is my current code and I am not sure how to implement the rest what the question is asking. I am not sure if my code is correct or not.

import random roll = random.randint(1, 6)

print ("Choosing a number between 1 and 6") print ("The number is ",end="") print (random.choice([1,2,3,4,5,6]))

When you run the program it should look like this

codio@mike-panther:~/workspace$ python3 die.py Choosing a number between 1 and 6. The number is 2.

Use your variables first and last to create the print statement. In particular, if you change first to 2 and last to 8, you should see something like this.

codio@mike-panther:~/workspace$ python3 die.py Choosing a number between 2 and 8. The number is 5.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!