When I execute this program inside the function it doesn't work, but when try to run it outside the function it gives me the outcome. I am new to programming, I have no idea why this is happening.
import random
v1 = (random.randint(1,6))
v2 = (random.randint(1,6))
print(v1 + v2)
def roll_dice():
import random
v1 = (random.randint(1,6))
v2 = (random.randint(1,6))
print(v1 + v2)
return (roll_dice)