Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 6 - Functions - Section 6.12 - Case Study: Generating Random ASCII Characters - Check Point - MyProgrammingLab - Page 192: 6.26

Answer

import random random_number = random.uniform(6.5, 56.4999)

Work Step by Step

The random module in Python provides several functions for generating random numbers. To get a random float number between 6.5 and 56.5 (excluding 56.5), you can use the uniform function: The uniform function returns a random floating-point number $N$ such that $a \leq N \leq b$ for the given arguments a and b. And since we gave $a$ as $6.5$ and $b$ as $56.4999$ we are able to generate a random number between $6.5$ and $56.4999$ which inherently excludes $56.5$
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.