[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Why do these errors pop up in lines where there isn't even
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 27
Thread images: 4
File: halp.jpg (247 KB, 1392x1011) Image search: [Google]
halp.jpg
247 KB, 1392x1011
Why do these errors pop up in lines where there isn't even any fucking code?
>>
>>52201777
You're retarded
It's 1, sides not sides, 1
>>
i don't actually know python but are you sure that code is for python 3?

also try:
import random

sides = 6
print(random.randint(1, sides, 1))
>>
>>52202299
actually just do what this guy said
>>
>>52201777
Find me a number between 6 and 1.
The smaller number needs to be first i believe.
Find me a number between 1 and 6... is what Python should react well with.
>>
>>52201777
when you import random, you import a whole list of other programs in to your own.

I don't know python, but don't you need a stdio library?

But yeah, there is a whole lot more than 3 lines of code in order to put some number on your screen.
>>
>>52202379
Someone clearly hasn't used python before. It works fine without all that, OP is just an idiot who got the order wrong
>>
>>52202299
What is the 1 for at the end of
print(random.randint(1,sides,1))

shouldn't it be
print(random.randint(1, sides))

?
>>
>>52201777
It doesn't work because 6 is bigger than 1 you fucking retard
>>
>>52202443
No read the fucking error message. It takes 3 arguments: istart, istop, width

I swear to fucking God you people...
>>
>>52202471
not op, but a random int in the range of 6 to 1 is expressively the same thing as a random int in the range of 1 to 6.

the library is retarded
>>
>>52202506
You are retarded for not reading the documentation.
>>
>>52202516
well, I don't know python and I don't need to know python to see that it could use improvement.
>>
>>52202503
width defaults to 1 you moron
>>
>>52202503
Hm, I didn't actually read the error messages.
I did try it out myself, however, and when I put 3 arguments in, it just spurts out an error.
>>
>>52202581
I meant to say, spurts out an error saying that too many arguments are given.
>>
File: Screenshot_2016-01-03-02-40-31.png (152 KB, 720x1280) Image search: [Google]
Screenshot_2016-01-03-02-40-31.png
152 KB, 720x1280
>>52202503
>>
>>52202678
Kek
See
>>52202575
And then
>>52202516
>>
File: Screenshot_2016-01-03-02-47-48.png (124 KB, 720x1280) Image search: [Google]
Screenshot_2016-01-03-02-47-48.png
124 KB, 720x1280
>>52202701
Dumb tripfag
>>
>>52202503
randint only takes two arguments...

https://docs.python.org/3.5/library/random.html#random.randint

randrange takes takes three, you idiot
>>
>>52202557
>well, I don't know python and I don't need to know python to see that it could use improvement.
Actually, you kind of do need to. This is simplest thing on the planet and you fuck it up then blame the language.
>>
>>52202869
>python users think there should be two types of ranges
>forward and backward ranges
lol
>>
>>52202900
What the fuck are you even talking about? There is only one way randint works. You start with the lower bound and specify a higher bound. It's not fucking rocket science.
>>
lol'd
>>
>>52201777
hey op, trying using a non-toy language like c++. then you'll understand the definition of a 'cryptic error message'.

i'm really shocked your retard-enabling language even has error messages, surprised it doesn't hold your hand or pat your head if make a mistake.
>>
>>52203267
also, i forgot to say, i am euphoric in this moment
>>
File: python.png (9 KB, 500x253) Image search: [Google]
python.png
9 KB, 500x253
>>52201777
Because the errors are happening in the module you're using, because you are using the function incorrectly. The smaller number comes first.
Thread replies: 27
Thread images: 4

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.