Representing infinity

0 votes
I was going through the pseudocode of an algorithm and there it assigns a variable to infinity. I know this makes some sense mathematically but is there a way to actually assign a variable to infinity in python?
Jun 27, 2018 in Python by nightshade
• 880 points
101 views

1 answer to this question.

0 votes
import math
infinity = math.inf

Now you can use infinity in your program

answered Jun 27, 2018 by Hamartia's Mask
• 1,580 points

Related Questions In Python

0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,413 views
0 votes
0 answers
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
1,811 views
0 votes
1 answer
+3 votes
1 answer

at model.fit I'm getting an error as : ValueError: Input contains NaN, infinity or a value too large for dtype('float32').

Hi, I think your X parameter contains null ...READ MORE

answered Apr 30, 2020 in Data Analytics by MD
• 95,300 points
1,221 views