Duplicate Question
The question on this page has been marked as a duplicate question.
Original Question
Complete the program below so it will generate three random numbers in the ranges indicated. Use the random.randrange() functio...Question
Complete the program below so it will generate three random numbers in the ranges indicated. Use the random.randrange() function to generate the numbers. All upper bounds listed are one larger than the largest desired value, so the random result will never actually match that value. To get consistent, testable results, the user will enter a seed value, and you must use the random.seed() function first and initialize the random number generator with the user's entered value.
Call random.seed() with the seedValue
Produce a random number between 0 and 100 and print the result to the screen with the message demonstrated below.
Produce a random number between 20 and 30 and print the result to the screen with the message demonstrated below.
Produce a random number between -10 and 10 and print the result to the screen with the message demonstrated below.
You can declare any local variables you like (if needed) to help finish your program. Parts of the print() statements are provided for you, but they are not complete.
The following examples demonstrate the expected output:
Enter integer seed: 1
Random value between 0 and 100 : 17
Random value between 20 and 30 : 29
Random value between -10 and 10: -8
Enter integer seed: 2
Random value between 0 and 100 : 7
Random value between 20 and 30 : 21
Random value between -10 and 10: -8
Enter integer seed: 3
Random value between 0 and 100 : 30
Random value between 20 and 30 : 29
Random value between -10 and 10: 7
Must be 100 grade
Call random.seed() with the seedValue
Produce a random number between 0 and 100 and print the result to the screen with the message demonstrated below.
Produce a random number between 20 and 30 and print the result to the screen with the message demonstrated below.
Produce a random number between -10 and 10 and print the result to the screen with the message demonstrated below.
You can declare any local variables you like (if needed) to help finish your program. Parts of the print() statements are provided for you, but they are not complete.
The following examples demonstrate the expected output:
Enter integer seed: 1
Random value between 0 and 100 : 17
Random value between 20 and 30 : 29
Random value between -10 and 10: -8
Enter integer seed: 2
Random value between 0 and 100 : 7
Random value between 20 and 30 : 21
Random value between -10 and 10: -8
Enter integer seed: 3
Random value between 0 and 100 : 30
Random value between 20 and 30 : 29
Random value between -10 and 10: 7
Must be 100 grade
Answers
Answer
Summary: 6 tests run, 3 tests passed, Original Grade = 55.0
------------------------------------------------------------------------------
PASSED: Source Test 1: Call random.seed() (+15.0)
PASSED: Output Test 5: Verify program output #1 (+20.0)
PASSED: Output Test 6: Verify program output #2 (+20.0)
FAILED: Source Test 2: Use rand.randrange() for number between 0 and 100 (-15.0)
FAILED: Source Test 3: Use rand.randrange() for number between 20 and 30 (-15.0)
FAILED: Source Test 4: Use rand.randrange() for number between -10 and 10 (-15.0)
------------------------------------------------------------------------------
PASSED: Source Test 1: Call random.seed() (+15.0)
PASSED: Output Test 5: Verify program output #1 (+20.0)
PASSED: Output Test 6: Verify program output #2 (+20.0)
FAILED: Source Test 2: Use rand.randrange() for number between 0 and 100 (-15.0)
FAILED: Source Test 3: Use rand.randrange() for number between 20 and 30 (-15.0)
FAILED: Source Test 4: Use rand.randrange() for number between -10 and 10 (-15.0)
Answer
Still the same
Answer
Fix this part
FAILED: Source Test 2: Use rand.randrange() for number between 0 and 100 (-15.0)
FAILED: Source Test 3: Use rand.randrange() for number between 20 and 30 (-15.0)
FAILED: Source Test 4: Use rand.randrange() for number between -10 and 10 (-15.0)
FAILED: Source Test 2: Use rand.randrange() for number between 0 and 100 (-15.0)
FAILED: Source Test 3: Use rand.randrange() for number between 20 and 30 (-15.0)
FAILED: Source Test 4: Use rand.randrange() for number between -10 and 10 (-15.0)
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.