Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions