Question: how to add last = 6 optional function. import random def rollem ( first , last ) : Returns the sum of

how to add last =6 optional function. import random
def rollem(first, last):
"""
Returns the sum of two random numbers.
The numbers generated are between first and last (inclusive).
Example: rollem(1,6) can return any value between 2 and 12.
Parameter first: The lowest possible number
Precondition: first is an integer
Parameter last: The greatest possible number
Precondition: last is an integer, last >= first
"""
#generating num1 and num2 randomly in range [first, last]
num1= random.randint(first,last)
num2= random.randint(first,last)
result = num1+ num2 #storing num1+ num2 in result
thesum =(result)
return thesum

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!