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

13th May 2019, 11:09 AM
Da Talking Pigeon
Da Talking Pigeon - avatar
4 odpowiedzi
13th May 2019, 11:26 AM
Anna
Anna - avatar
+ 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
13th May 2019, 11:42 AM
Anna
Anna - avatar
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
13th May 2019, 11:39 AM
Da Talking Pigeon
Da Talking Pigeon - avatar
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
13th May 2019, 11:46 AM
Da Talking Pigeon
Da Talking Pigeon - avatar