mardi 26 octobre 2021

random.seed does not work in Python 3.9.7 using Spyder

very simple program given below.

import random
random.random()
random.seed(3)

Gives error message as File "C:\Users\admin\ram_stuff\Pythonprogs\random_passwd.py", line 11, in random.seed(3)

TypeError: 'int' object is not callable

I can go to cmd window in Windows10 and it runs fine.

C:\Users\admin>python
Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

>>> import random
>>> random.random()
0.7989453624569347
>>> random.seed(3)
>>> random.random()
0.23796462709189137

Thank you.




Aucun commentaire:

Enregistrer un commentaire