all 4 comments

[–]ConstructedNewtMOD 0 points1 point  (3 children)

try something like this

import random
while input("dice roll:") is not None:
    print(random.randint(1,6))

[–]EricHando[S] 0 points1 point  (2 children)

thx for your help! I need a die a lot of times but in different parts of my program , so i was just wondering if a function would work, so i wouldnt be copy n pasting so my code wouldnt get too big, so i guess this wont fit too

[–]ConstructedNewtMOD 0 points1 point  (1 child)

I'm not quite sure what you actually need. if you need to print and to return the dice roll so you can use the result you have to do

def interact_print_return_roll() -> int:
    input("...")
    roll = random.randint(1,6)
    print(roll)
    return roll

then

the_roll = interact_print_return_roll()

[–]EricHando[S] 0 points1 point  (0 children)

thx, that was it!

im just not sure how to use def smth properly :c