How to make this easier | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to make this easier

Neeeeeed hellllllpp on how to make this shorter https://code.sololearn.com/c7Vbmw9VH06D/?ref=app

13th Aug 2019, 11:14 PM
kk1234567
kk1234567 - avatar
9 Answers
+ 1
Well, you can assign 4 random numbers on one line instead of four like you have now. https://code.sololearn.com/c5Gb1SzUMTHR/?ref=app
14th Aug 2019, 12:29 AM
Rora
+ 1
Whats np.random
14th Aug 2019, 12:31 AM
kk1234567
kk1234567 - avatar
+ 1
It’s a numpy module for generating random number ndarrays
14th Aug 2019, 12:49 AM
Rora
+ 1
It’s not applicable anymore because I noticed that you have a different range for each random number
14th Aug 2019, 12:50 AM
Rora
+ 1
Then if you want four random ints you would use np.random.randint(4, low, high)
14th Aug 2019, 12:55 AM
Rora
0
Oh :(
14th Aug 2019, 12:51 AM
kk1234567
kk1234567 - avatar
0
What if i make the range the same
14th Aug 2019, 12:52 AM
kk1234567
kk1234567 - avatar
0
It s showing np not defined
14th Aug 2019, 12:58 AM
kk1234567
kk1234567 - avatar
0
you have to import numpy as np. Sorry if that wasn’t clear.
14th Aug 2019, 11:29 AM
Rora