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
• 870 points
15 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

+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 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 124 views
+4 votes
6 answers