M4) Does It Run?
Consider the Python code snippets in Listing 1. Each snippet attempts to generate a random floating-point number between a lower bound (inclusive) and an upper bound (exclusive).
Which of the code snippets in Listing 1 will run without errors when executed?
Tip
Pay attention to the colon after each def header, the return statement, and whether every name used in test has been defined.
TipFunctions Used in the Python Code Snippets
random: function from Python’srandommodule that returns a floating-point number in the interval \([0, 1)\).print: built-in function that displays a value.def: keyword used to define a function.return: statement that sends a value back to the function caller.