+ 3
Infinite number range
Is there a way for the range of my number to be 0 through infinity? https://code.sololearn.com/cyAAdD3lITtl/?ref=app
10 ответов
+ 10
Infinity is used in mathematics to represent a really large number. There is no such thing as infinity in computers. There's a limit for computers and for languages. You can even reason that infinity doesn't even exist, but that's not the point here.
So as infinity doesn't exist, what's the next best thing? 'Course it's the upper limit of your language(Python) and I've shown how to do that in the below code
https://code.sololearn.com/cY8870hF7YeO/?ref=app
+ 5
Also, even if it were possible, picking a random number between 0 and infinity is probably never what you want.
If you pick a random number between 0 and 10, then on average, you will expect the size of your number to be around 5.
Picking a random number between 0 and infinity will, on average, lead to infinitely long numbers, which take an infinitely long time to print onto your screen, which will probably crash the program/computer in the process.
+ 3
Your Mom I think u can just find a random number from -(sys.maxsize) to 0. Here's a code that i created from tweaking the my original solution, i guess it works right.
https://code.sololearn.com/cYAlWZqJ3GB2/?ref=app
+ 2
Didnt work
+ 2
It syas it cant import information from math
+ 2
Thank you!
+ 2
Happy to help :)
+ 2
Okay, so what would i do if i wanted the lowest number possible?
+ 2
Okay, yea i guess it works thanks again
+ 2
Happy to help again😃👍