1. Write a function called is equal that takes two numbers and returns True if the numbers are equal and False if they are not equal. This function will be tested using unit tests and requires no input and does not need to be called from the main() function.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
1. Write a function called is_equal that takes two numbers and returns True if the numbers are equal and False if they are not equal.
This function will be tested using unit tests and requires no input and does not need to be called from the main() function.
2. Write a function called my_random that takes two numbers, a low value and a high value. The function should generate two random
numbers between the low value and high value and return the larger of the two. You should seed the random number generator with
the value 10 (use random.seed (10)). This function will be tested using unit tests and requires no input and does not need to be
called from the main() function.
3. Write a function called roll_dice which takes, in order, a number representing the number of dice and a number representing the
number of sides on the dice. The function should print a dice roll with a value between 1 and the number of sides on the die for each
of the number of dice. You should seed the random number generator with the value 10. You should make two successive calls to
this function using the arguments 4, 8 and 5,10. You may hard code these values into your main function.
4. Write a function called roll_no_pair_dice which takes, in order, a number representing the number of pairs of dice to roll and a
number representing the number of sides on the dice. You should seed the random number generator with the value 10. This version
will roll pairs of dice, but will only count and print rolls where the two dice have different numbers. For instance, two rolls of two 6-
sided dice could result in: 1 3 4 6, but not: 1 1 2 3. You must call your is_equal function to test whether the two dice are the
same. You should make one call to this function using the arguments 5,10. You may hard code these values into your main function.
Transcribed Image Text:1. Write a function called is_equal that takes two numbers and returns True if the numbers are equal and False if they are not equal. This function will be tested using unit tests and requires no input and does not need to be called from the main() function. 2. Write a function called my_random that takes two numbers, a low value and a high value. The function should generate two random numbers between the low value and high value and return the larger of the two. You should seed the random number generator with the value 10 (use random.seed (10)). This function will be tested using unit tests and requires no input and does not need to be called from the main() function. 3. Write a function called roll_dice which takes, in order, a number representing the number of dice and a number representing the number of sides on the dice. The function should print a dice roll with a value between 1 and the number of sides on the die for each of the number of dice. You should seed the random number generator with the value 10. You should make two successive calls to this function using the arguments 4, 8 and 5,10. You may hard code these values into your main function. 4. Write a function called roll_no_pair_dice which takes, in order, a number representing the number of pairs of dice to roll and a number representing the number of sides on the dice. You should seed the random number generator with the value 10. This version will roll pairs of dice, but will only count and print rolls where the two dice have different numbers. For instance, two rolls of two 6- sided dice could result in: 1 3 4 6, but not: 1 1 2 3. You must call your is_equal function to test whether the two dice are the same. You should make one call to this function using the arguments 5,10. You may hard code these values into your main function.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Types of Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education