I have a very simple problem, when I run the following code:
from random import randint
def create_random():
x = random.randint(1,4)
return x
print(create_random)
The output comes to this:
< function create_random at 0x7f5994bd4f28 >
Note: every character between "0x7f" and "f28" are random each time the code is run.
My goal was to be able to call the function multiple times with x being assigned a new integer value between 1 and 3 with each invocation.
You aren't actually calling the function. To do this you need to do:
print(create_random())
Just now you're printing the reference to the function which isn't very helpful for you in this case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With