qpython icon indicating copy to clipboard operation
qpython copied to clipboard

How do I get the random module to work?

Open jcarmbruster opened this issue 6 years ago • 2 comments

I've installed Qpython3 on my android cellphone.

However, when I typed in "import random" in one program, and ran the program, the following error message appears: Traceback (most recent call last): File "/storage/emulated/0/qpython/scripts3/.last_tmp.py", line 11, in import random.py File "/storage/emulated/0/qpython/scripts3/random.py", line 7, in < module> random.randint(0,2) AttributeError: 'module' object has no attribute 'randint' 1ǀuo_a183@tc_a32ewh1:/ $

What does this mean? And how can I get the random module to run properly?

Thanks,

J.C. (John Clifford) Armbruster

jcarmbruster avatar May 03 '19 00:05 jcarmbruster

try dir(random)

Get Outlook for Androidhttps://aka.ms/ghei36


From: jcarmbruster [email protected] Sent: Friday, May 3, 2019 8:02:52 AM To: qpython-android/qpython Cc: Subscribed Subject: [qpython-android/qpython] How do I get the random module to work? (#169)

I've installed Qpython3 on my android cellphone.

However, when I typed in "import random" in one program, and ran the program, the following error message appears: Traceback (most recent call last): File "/storage/emulated/0/qpython/scripts3/.last_tmp.py", line 11, in import random.py File "/storage/emulated/0/qpython/scripts3/random.py", line 7, in < module> random.randint(0,2) AttributeError: 'module' object has no attribute 'randint' 1ǀuo_a183@tc_a32ewh1:/ $

What does this mean? And how can I get the random module to run properly?

Thanks,

J.C. (John Clifford) Armbruster

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/qpython-android/qpython/issues/169, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AH4NPL4MMZG6EH3BTCSIXE3PTN6KZANCNFSM4HKNG7KQ.

hailingfang avatar May 07 '19 03:05 hailingfang

For me it works on version 2.6.0 this: random import print (random.randint (0,6))

https://github.com/qpython-android/qpython/releases/tag/v2.6.0

git-jr avatar Jul 28 '19 02:07 git-jr