+ 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

28th Feb 2022, 2:56 AM
Your Mom
Your Mom - avatar
10 Answers
+ 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
28th Feb 2022, 3:22 AM
Rishi
Rishi - avatar
+ 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.
28th Feb 2022, 8:45 AM
Schindlabua
Schindlabua - avatar
+ 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
28th Feb 2022, 2:34 PM
Rishi
Rishi - avatar
+ 2
Didnt work
28th Feb 2022, 3:16 AM
Your Mom
Your Mom - avatar
+ 2
It syas it cant import information from math
28th Feb 2022, 3:21 AM
Your Mom
Your Mom - avatar
+ 2
Thank you!
28th Feb 2022, 3:24 AM
Your Mom
Your Mom - avatar
+ 2
Happy to help :)
28th Feb 2022, 3:25 AM
Rishi
Rishi - avatar
+ 2
Okay, so what would i do if i wanted the lowest number possible?
28th Feb 2022, 2:12 PM
Your Mom
Your Mom - avatar
+ 2
Okay, yea i guess it works thanks again
28th Feb 2022, 2:36 PM
Your Mom
Your Mom - avatar
+ 2
Happy to help again😃👍
28th Feb 2022, 2:37 PM
Rishi
Rishi - avatar