qpython-android / qpython

QPython is an Android Python engine primarily designed for Python and AI learners. It offers a range of impressive features to enhance Python programming experience.
https://www.qpython.org
1.06k stars 193 forks source link

How do I get the random module to work? #169

Open jcarmbruster opened 5 years ago

jcarmbruster commented 5 years ago

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

hailingfang commented 5 years ago

try dir(random)

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


From: jcarmbruster notifications@github.com 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.

git-jr commented 5 years ago

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