Module: random | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Module: random

I am getting the error: Value error: random.randint(1,1,0) As 1 - start 1- stop What is 0?? Why I am getting this error

18th Apr 2020, 9:24 AM
Pooja Sharma
Pooja Sharma - avatar
4 Answers
+ 2
As I understand, `randint` takes two parameters instead of three.
18th Apr 2020, 9:59 AM
Ipang
+ 2
Where did you see this code BTW? randint takes only 2 parameters, giving 3 will cause error. * Reference: https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/ref_random_randint.asp (Edited)
18th Apr 2020, 10:07 AM
Ipang
+ 1
yeah thats what I do but I am getting an error with 3 parameters. value error(1,1,0)
18th Apr 2020, 10:06 AM
Pooja Sharma
Pooja Sharma - avatar
0
That may be randrange not randint. Then 3rd parameter is step count. random.randrange(1,10,2) Or see from this link about use of arrays by importing numpy.. https://pynative.com/JUMP_LINK__&&__python__&&__JUMP_LINK-random-randrange/
18th Apr 2020, 10:41 AM
Jayakrishna 🇮🇳