0

So as I said in my last post that I'm a very beginner at python I just wanna ask that can you range number between 0 to inf in python because if I use range(1, float('inf')) it would be an error so I guess that because in range() you can only put int not float also I can't change inf(which is now in float) into int because it can only be in float so pls help me.

ps sorry for my bad grammar I'm not a native speaker

MPH_08
  • 1
  • 1
  • 1 to infinity also means more than 1. So why don't you use that instead? Adding your case of using infinity will hlep. – BernardL Nov 13 '20 at 08:11
  • 2
    does this answer your question? https://stackoverflow.com/questions/9884213/looping-from-1-to-infinity-in-python – token Nov 13 '20 at 08:11
  • There is no way, you can do this. `Inf` is not necessarily meant to be used just for saturating the numbers. OK, anyway: You want to have a sequence from `1` to the maximum number that can be represented in MATLAB, right? So go with `1:realmax`. See [realmax](https://www.mathworks.com/help/matlab/ref/realmax.html) – max Nov 13 '20 at 08:14
  • I guess you can write a generator to keep generating an ever increasing value. – DaveIdito Nov 13 '20 at 08:17
  • thankyou very much for all the answer – MPH_08 Nov 13 '20 at 09:27

0 Answers0