0
Write A Function that recieves 2 numbers and generates a random number from that range and prints it.
Can anyone help me out please
4 Answers
+ 5
What have you tried so far?
https://www.sololearn.com/discuss/1316935/?ref=app
+ 4
Looks good. Your function doesn't return anything though. Add "return number" at the end. And you should import random at the beginning of your code, not in your function
0
def fun(a,b):
import random
number=random.randint(a,b)
x=int(input("Enter first Number :"))
y=int(input("Enter second Number :"))
print(fun(x,y))
Is there some problem in it? :O
0
def fun(a,b):
import random
number=random.randint(a,b)
return number
x=int(input("Enter a first Number :"))
y=int(input("Enter a second Number :"))
print(fun(x,y))
Well yeah it is working now